emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing line widths in the Emacs source code


From: Göktuğ Kayaalp
Subject: Re: Changing line widths in the Emacs source code
Date: Sun, 13 Sep 2020 23:13:43 +0300
User-agent: mu4e 1.2.0; emacs 28.0.50

On 2020-09-13 21:38 +03, Vladimir Sedach <vas@oneofus.la> wrote:
> Alan Mackenzie <acm@muc.de> writes:
> The optimum line length for legibility has been found to be 55-60
> characters over hundreds of years of book publishing experience. 90
> characters per line is considered the absolute maximum, and you
> rarely see it. "Today's wide screens" is as bad of a reason for
> increasing line length in text files as "today's wide paper" would be
> an excuse to increase line length in books.

Not to refute any other points here, but this is an oft-mentioned
factoid, yet code is not prose, so how relevant this is is questionable.
Most importantly, a decent chunk of an average line is indentation:

(require 'cl-lib)
(let ((spaces '(0))
      (line-count 1))
  (with-current-buffer "org.el.gz"
    (goto-char (point-min))
    (while (not (looking-at "\\'"))
      ;; expand tabs, 8 spaces in my setup
      (untabify
       (line-beginning-position)
       (save-excursion (back-to-indentation) (point)))
      (push
       (- (save-excursion (back-to-indentation) (point))
          (line-beginning-position))
       spaces)
      (cl-incf line-count)
      ;; beginning of next line
      (goto-char (1+ (line-end-position)))))
  (message "On average %f spaces worth of indentation per line (%d lines)"
           (/ (apply #'+ spaces) (float line-count))
           line-count))

=> "On average 7.957429 spaces worth of indentation per line (21235 lines)"

So assuming 80-char lines, on average 1/10 of a line is leading
whitespace.

--
İ. Göktuğ Kayaalp / @cadadr / <https://www.gkayaalp.com/>
pgp:   024C 30DD 597D 142B 49AC 40EB 465C D949 B101 2427



reply via email to

[Prev in Thread] Current Thread [Next in Thread]