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: Mon, 14 Sep 2020 00:23:33 +0300
User-agent: mu4e 1.2.0; emacs 28.0.50

On 2020-09-13 23:52 +03, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> So, ~8 columns of indentation, which leaves ~72 columns of actual text.
> Since most lines don't extend all the way to the 80th column, that means
> most lines stick within the 55-60 optimum.

Much less, actually:

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

=> "On average 34.588839 chars per line excluding indentation (21235 lines)"

So around a comfy 35 chars of code per line.  Also:

(let ((spaces '(0))
      (line-count 1))
  (with-current-buffer "org.el.gz"
    (goto-char (point-min))
    (while (not (looking-at "\\'"))
      (push
       (- (line-end-position)
          (line-beginning-position))
       spaces)
      (cl-incf line-count)
      ;; beginning of next line
      (goto-char (1+ (line-end-position)))))
  (message "On average %f chars per line (%d lines)"
           (/ (apply #'+ spaces) (float line-count))
           line-count))

=> "On average 37.766847 chars per line (21235 lines)"

Your average line is 38 chars long, indentation included.

If anybody wants to replicate this, this is from a build of Emacs from
"931b9f5953013c1e8844d0c723411b87ccfedb1a".

--
İ. 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]