From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Robert J. Chassell" Newsgroups: gmane.emacs.devel Subject: Re: Source code formatting: line length limit? Date: Sun, 26 Jan 2003 18:49:10 +0000 (UTC) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <84ptqlflp7.fsf@lucy.is.informatik.uni-duisburg.de> <84lm187ysa.fsf@lucy.is.informatik.uni-duisburg.de> Reply-To: bob@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1043607251 484 80.91.224.249 (26 Jan 2003 18:54:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 26 Jan 2003 18:54:11 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18cruz-00007f-00 for ; Sun, 26 Jan 2003 19:54:09 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18cryp-0002AI-00 for ; Sun, 26 Jan 2003 19:58:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18crsd-0002Cj-07 for emacs-devel@quimby.gnus.org; Sun, 26 Jan 2003 13:51:43 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18crs0-0001zY-00 for emacs-devel@gnu.org; Sun, 26 Jan 2003 13:51:04 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18crr5-0001Oe-00 for emacs-devel@gnu.org; Sun, 26 Jan 2003 13:50:28 -0500 Original-Received: from megalith.rattlesnake.com ([140.186.114.245] helo=localhost) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18crqe-00013e-00 for emacs-devel@gnu.org; Sun, 26 Jan 2003 13:49:41 -0500 Original-Received: by rattlesnake.com via sendmail from stdin id (Debian Smail3.2.0.114) Sun, 26 Jan 2003 18:49:10 +0000 (UTC) Original-To: emacs-devel@gnu.org In-reply-to: <84lm187ysa.fsf@lucy.is.informatik.uni-duisburg.de> (kai.grossjohann@uni-duisburg.de) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:11098 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11098 I think both of you implicitly imply that text *over* 80 columns is bad and should be avoided. Yes. To illustrate my problem: I have just reformatted source code from something like 120 columns to something below 80. Good. There are several different reasons to prefer less than 80 columns: * Consider someone who is interested in your code: most likely he or she is viewing it in an 80 column width window or on a terminal with no more than 80 columns. Not everyone uses 80 columns or less, but large numbers do. If your reader uses 80 columns or less, either your reader reformats the code or widens the window (assuming the latter action is possible) Either way makes for more work for your reader, and less likelihood that your code will be studied as thoroughly as you would like. * Again, consider someone who is interested in your code: one of your readers may be different, but over the past 500 years, printers have found that most readers tend to have a hard time moving their eyes from one line to another unless the text posseses the right balance of line length and between-line blank space. One old `rule of thumb' for determining maximum line length was `twice the alphabet plus the punctuation'. For English readers, this leads to line lengths in the 60s, depending on what you consider to be punctuation. Computer displays often use a little more inter-line spacing than printed books, and tend to do well with a maximum line length of 70. * Determining line length for computer code is harder than for text, because of the advantage of conciseness. A programmer reading your code may well have an easier time understanding a single expression that is all on one line than the same expression split over several lines. So that favors longer linges. On the other hand, no one can readily ready code that goes beyound the right hand boundary of the screen, regardless whether the line is truncated or wrapped at the 80th character. Hence, it is a good idea to make sure the right hand side of the line is less than 80 characters from the left. At the same time, code is often indented. In general, this is an advantage; but at the same time, the reader may get lost in the blank space to the left of the code. To counter this problem, I often delimit expressions using GNU Emacs' parenthesis balancing feature. But at the same time, I also make use of indenting; for example, just yesterday, I ran `pp' on the automatically generated, unforatted code that records a spreadsheet in Emacs Dismal mode, so I could read it. -- Robert J. Chassell Rattlesnake Enterprises http://www.rattlesnake.com GnuPG Key ID: 004B4AC8 http://www.teak.cc bob@gnu.org