adhere to 80 char limit and make Emacs help me with it

status

done

type

task

description There are several reasons to still adhere to an 80 character limit (or, a 74 character limit is even better; it allows for the code to remain fewer than 80 columns even when diff markers and email quoting is added, if you do code review on mailing lists). Even in the era of widescreen monitors, I like to have several windows open side by side, showing different parts of the code. For instance, I usually have a web browser and email open on one screen, and two files and a terminal open side by side on a second monitor. If you have lines that run over 80 columns, you need to deal with the editor wrapping the lines (which is ugly and makes the code harder to navigate around), or widen you windows such that you can't fit as many on screen at once. Even if you don't usually edit this way, if you ever use a side-by-side diff tool, you will appreciate files with reasonable line lengths which will make your diff easier to view. There's also an issue of code density. I like to have a lot of context when reading code. It is much, much quicker to glance up and down a window than it is to scroll. If you have very long lines, you also tend to have lines that vary in length a lot, leading to a lot of wasted screen real estate and being able to fit less code on screen at a given time overall. And finally, if you have very long lines, then that generally means that you have very complicated lines, deep indendation, or that you have very long identifiers. All of these can be a problem. Complicated lines are probably doing too much; if you can break it down into several simpler lines, you probably should. Deep indentation means that you're probably nesting too many loops and conditionals, which can make your code flow confusing; considering refactoring into several functions. And if your identifiers are too long, it can make reading your code very difficult. People generally recognize words as individual units; they don't read every character one by one, but look at the overall shape of the word. Long identifiers are harder to distinguish this way, and usually if they are that long, they contain redundant or repetitive information. Now, while it's still good practice to keep code below 80 columns, this isn't one of those rules that needs to be followed religiously, contorting yourself to make some line fit when it just doesn't. I suggest that you try to keep all of your code under 80 columns, but when it just doesn't fit, don't worry about it too much.
human iduberprojekt-311priority0ide7e55efe-2a30-43a1-be2f-acd5c1a5f016