unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Göktuğ Kayaalp" <self@gkayaalp.com>
To: emacs-devel@gnu.org
Cc: Alan Mackenzie <acm@muc.de>
Subject: Re: Changing line widths in the Emacs source code
Date: Sun, 13 Sep 2020 23:13:43 +0300	[thread overview]
Message-ID: <87o8m9sadk.fsf@gkayaalp.com> (raw)
In-Reply-To: <87d02pmsi7.fsf@t510.orion.oneofus.la>

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	other threads:[~2020-09-13 20:13 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 13:45 Changing line widths in the Emacs source code Lars Ingebrigtsen
2020-09-13 13:58 ` Stefan Kangas
2020-09-13 14:09   ` Lars Ingebrigtsen
2020-09-13 15:53     ` Stefan Kangas
2020-09-13 16:21       ` Lars Ingebrigtsen
2020-09-13 16:51         ` Yuan Fu
2020-09-13 16:58           ` Lars Ingebrigtsen
2020-09-13 17:55             ` Stephen Leake
2020-09-13 18:04             ` arthur miller
2020-09-13 17:34           ` Eric Abrahamsen
2020-09-13 17:54         ` Stephen Leake
2020-09-13 14:22 ` Alan Mackenzie
2020-09-13 18:38   ` Vladimir Sedach
2020-09-13 20:13     ` Göktuğ Kayaalp [this message]
2020-09-13 20:52       ` Stefan Monnier
2020-09-13 21:23         ` Göktuğ Kayaalp
2020-09-14  0:08           ` Tim Cross
2020-09-13 23:45       ` Óscar Fuentes
2020-09-14  2:23         ` Stefan Monnier
2020-09-14  2:28           ` T.V Raman
2020-09-14  7:42             ` tomas
2020-09-14  9:59             ` Alan Third
2020-09-15  7:25     ` Stefan Kangas
2020-09-13 14:53 ` Daniel Martín
2020-09-13 15:01   ` Lars Ingebrigtsen
2020-09-13 17:23     ` Andy Moreton
2020-09-13 17:29       ` Lars Ingebrigtsen
2020-09-13 18:07         ` Göktuğ Kayaalp
2020-09-13 15:09   ` Stefan Kangas
2020-09-13 14:54 ` Eli Zaretskii
2020-09-13 14:57   ` Lars Ingebrigtsen
2020-09-13 15:13     ` Eli Zaretskii
2020-09-13 17:15       ` Lars Ingebrigtsen
2020-09-13 15:27 ` Stefan Monnier
2020-09-13 17:31   ` Dmitry Gutov
2020-09-13 17:34   ` Andrea Corallo via Emacs development discussions.
2020-09-16  6:42   ` jeremyb
2020-09-13 15:28 ` Göktuğ Kayaalp
2020-09-13 15:43 ` Óscar Fuentes
2020-09-13 17:07   ` Amin Bandali
2020-09-13 18:01   ` Stephen Leake
2020-09-13 18:17     ` Göktuğ Kayaalp
2020-09-14  3:50 ` Richard Stallman
2020-09-14 19:25 ` David Koppelman
2020-09-15  8:53 ` Lars Brinkhoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8m9sadk.fsf@gkayaalp.com \
    --to=self@gkayaalp.com \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).