unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Changing line widths in the Emacs source code
@ 2020-09-13 13:45 Lars Ingebrigtsen
  2020-09-13 13:58 ` Stefan Kangas
                   ` (9 more replies)
  0 siblings, 10 replies; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 13:45 UTC (permalink / raw)
  To: emacs-devel

Now for the most controversial suggestion of all: Make the Emacs code
wider!

Emacs has tried to keep the line width of the source code at 80
characters since Emacs was created.  It was a good choice (perhaps the
only) back then, but most screens are wide and short these days, and the
folding contortions we have to do to make everything fit in 80
characters is sometimes annoying, and leads to code that's awkward to
read.

So my suggestion is: Change the default to 100.

(This, of course, doesn't mean that we change any of the existing code,
but we stop formatting all new code to fit within 80 columns, and
instead aim for 100 instead.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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 14:22 ` Alan Mackenzie
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 45+ messages in thread
From: Stefan Kangas @ 2020-09-13 13:58 UTC (permalink / raw)
  To: Lars Ingebrigtsen, emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> So my suggestion is: Change the default to 100.

I am in favour of this.

But I thought the current default was 70?  At least that's what
fill-column in .dir-locals.el indicates.  Is that only for docstrings
perhaps?



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 13:58 ` Stefan Kangas
@ 2020-09-13 14:09   ` Lars Ingebrigtsen
  2020-09-13 15:53     ` Stefan Kangas
  0 siblings, 1 reply; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 14:09 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel

Stefan Kangas <stefankangas@gmail.com> writes:

> But I thought the current default was 70?  At least that's what
> fill-column in .dir-locals.el indicates.  Is that only for docstrings
> perhaps?

Yes, that's for text only -- not just docstrings, but also comments and
the like, I think?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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:22 ` Alan Mackenzie
  2020-09-13 18:38   ` Vladimir Sedach
  2020-09-13 14:53 ` Daniel Martín
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 45+ messages in thread
From: Alan Mackenzie @ 2020-09-13 14:22 UTC (permalink / raw)
  To: emacs-devel

Hello, Lars.

On Sun, Sep 13, 2020 at 15:45:57 +0200, Lars Ingebrigtsen wrote:
> Now for the most controversial suggestion of all: Make the Emacs code
> wider!

> Emacs has tried to keep the line width of the source code at 80
> characters since Emacs was created.  It was a good choice (perhaps the
> only) back then, ....

It remains a good choice, now.  Wide text is more difficult to read.
For that reason, newspaper columns (remember them?) were typically much
less than 80 columns wide.

> .... but most screens are wide and short these days, and the
> folding contortions we have to do to make everything fit in 80
> characters is sometimes annoying, and leads to code that's awkward to
> read.

Code that is awkward to fit into 80 columns would perhaps do better with
some refactoring.  But even some of the CC Mode functions which are far
too long in terms of number of lines (e.g. c-forward-decl-or-cast-1,
c-guess-basic-syntax) don't have terrible trouble in 80 columns.

> So my suggestion is: Change the default to 100.

My Linux TTY screen is 240 characters wide and 67 lines high.  With that
I can get Follow Mode three windows wide, giving me a total display of
195 contiguous lines of a single buffer.  There are only occasional
lines which need to be wrapped.  This is very helpful, particularly
whilst debugging.

Were the gentlemen's agreement that buffers are max. 80 chars wide to be
rescinded, Follow mode and other arrangements of side-by-side windows
would become that much less useful.

> (This, of course, doesn't mean that we change any of the existing code,
> but we stop formatting all new code to fit within 80 columns, and
> instead aim for 100 instead.)

I am against this.

> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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:22 ` Alan Mackenzie
@ 2020-09-13 14:53 ` Daniel Martín
  2020-09-13 15:01   ` Lars Ingebrigtsen
  2020-09-13 15:09   ` Stefan Kangas
  2020-09-13 14:54 ` Eli Zaretskii
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 45+ messages in thread
From: Daniel Martín @ 2020-09-13 14:53 UTC (permalink / raw)
  To: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

>
> So my suggestion is: Change the default to 100.
>
> (This, of course, doesn't mean that we change any of the existing code,
> but we stop formatting all new code to fit within 80 columns, and
> instead aim for 100 instead.)

I don't agree with this suggestion, at least as it is written. If the
existing code won't change, then we will have parts of the codebase with
a different style than others. The goal of having a code style is not
much about the individual decisions, but about consistency.

Also, what would happen if you change code in an existing file? Would
you need to fit it in 80 columns, 100 columns? Our .clang-format file
would format the code using 100 columns, so it'll probably do the wrong
thing by default.

It all seems unnecessary complexity to me.



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 13:45 Changing line widths in the Emacs source code Lars Ingebrigtsen
                   ` (2 preceding siblings ...)
  2020-09-13 14:53 ` Daniel Martín
@ 2020-09-13 14:54 ` Eli Zaretskii
  2020-09-13 14:57   ` Lars Ingebrigtsen
  2020-09-13 15:27 ` Stefan Monnier
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 45+ messages in thread
From: Eli Zaretskii @ 2020-09-13 14:54 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Sun, 13 Sep 2020 15:45:57 +0200
> 
> Now for the most controversial suggestion of all: Make the Emacs code
> wider!

The two immediate problems are: TTYs, and the GUI frame defaults we
currently use: they will cause the wide source lines to look ugly.



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 14:54 ` Eli Zaretskii
@ 2020-09-13 14:57   ` Lars Ingebrigtsen
  2020-09-13 15:13     ` Eli Zaretskii
  0 siblings, 1 reply; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 14:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> The two immediate problems are: TTYs, and the GUI frame defaults we
> currently use: they will cause the wide source lines to look ugly.

What GUI frame defaults were you thinking of?  I tried a wider Emacs
now, and I couldn't see anything immediately horrible...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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 15:09   ` Stefan Kangas
  1 sibling, 1 reply; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 15:01 UTC (permalink / raw)
  To: Daniel Martín; +Cc: emacs-devel

Daniel Martín <mardani29@yahoo.es> writes:

> I don't agree with this suggestion, at least as it is written. If the
> existing code won't change, then we will have parts of the codebase with
> a different style than others. The goal of having a code style is not
> much about the individual decisions, but about consistency.

Nope -- in the Emacs tree, we're all about not making needless stylistic
changes, really.  That's why we don't make white space changes, and we
don't change one-form `if' statements into `when' across the board.

We just live with it, and write the new code using whatever standard
we've settled on.

> Also, what would happen if you change code in an existing file? Would
> you need to fit it in 80 columns, 100 columns?

I'm not sure I understand what you're asking -- we never change the
formatting of anything (unless we rewrite the code), so nothing changes.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 14:53 ` Daniel Martín
  2020-09-13 15:01   ` Lars Ingebrigtsen
@ 2020-09-13 15:09   ` Stefan Kangas
  1 sibling, 0 replies; 45+ messages in thread
From: Stefan Kangas @ 2020-09-13 15:09 UTC (permalink / raw)
  To: Daniel Martín, emacs-devel

Daniel Martín <mardani29@yahoo.es> writes:

> If the existing code won't change, then we will have parts of the
> codebase with a different style than others. The goal of having a code
> style is not much about the individual decisions, but about
> consistency.

What you say seems to imply that we can never change a stylistic
convention until someone produces a patch that fixes the entire source
tree to use it.  Maybe there is something in your argument that I don't
understand.

AFAIU, with a new convention code would slowly change over time.

> Also, what would happen if you change code in an existing file? Would
> you need to fit it in 80 columns, 100 columns? Our .clang-format file
> would format the code using 100 columns, so it'll probably do the wrong
> thing by default.

You would apply the new convention judiciously, just like you would do
today with the old one.  It's not like the current convention is
enforced strictly, and there are already examples when it's not being
followed.



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 14:57   ` Lars Ingebrigtsen
@ 2020-09-13 15:13     ` Eli Zaretskii
  2020-09-13 17:15       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 45+ messages in thread
From: Eli Zaretskii @ 2020-09-13 15:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: emacs-devel@gnu.org
> Date: Sun, 13 Sep 2020 16:57:48 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > The two immediate problems are: TTYs, and the GUI frame defaults we
> > currently use: they will cause the wide source lines to look ugly.
> 
> What GUI frame defaults were you thinking of?

The default dimensions of the GUI frames we create.  Including the
initial frame.  They should be wider, if we want the wide sources to
look nicely on them, no?



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 13:45 Changing line widths in the Emacs source code Lars Ingebrigtsen
                   ` (3 preceding siblings ...)
  2020-09-13 14:54 ` Eli Zaretskii
@ 2020-09-13 15:27 ` Stefan Monnier
  2020-09-13 17:31   ` Dmitry Gutov
                     ` (2 more replies)
  2020-09-13 15:28 ` Göktuğ Kayaalp
                   ` (4 subsequent siblings)
  9 siblings, 3 replies; 45+ messages in thread
From: Stefan Monnier @ 2020-09-13 15:27 UTC (permalink / raw)
  To: emacs-devel

> So my suggestion is: Change the default to 100.

Heresy!


        Stefan


PS: Yes, it's a joke, but I do think 80 columns is a better choice.
Moving to 100 columns means I won't be able to see as many windows side
by side on my screen.




^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 13:45 Changing line widths in the Emacs source code Lars Ingebrigtsen
                   ` (4 preceding siblings ...)
  2020-09-13 15:27 ` Stefan Monnier
@ 2020-09-13 15:28 ` Göktuğ Kayaalp
  2020-09-13 15:43 ` Óscar Fuentes
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 45+ messages in thread
From: Göktuğ Kayaalp @ 2020-09-13 15:28 UTC (permalink / raw)
  To: emacs-devel

On 2020-09-13 16:45 +03, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Now for the most controversial suggestion of all: Make the Emacs code
> wider!
[... snip ...]
> So my suggestion is: Change the default to 100.

+1.  I don’t really contribute much to core apart from seldom bugfixes,
but there is my vote.

Frankly the world would be better off if the general convention was
"keep it around 70-90 chars per line but don’t contort your code just to
achieve that".


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



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 13:45 Changing line widths in the Emacs source code Lars Ingebrigtsen
                   ` (5 preceding siblings ...)
  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-14  3:50 ` Richard Stallman
                   ` (2 subsequent siblings)
  9 siblings, 2 replies; 45+ messages in thread
From: Óscar Fuentes @ 2020-09-13 15:43 UTC (permalink / raw)
  To: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Now for the most controversial suggestion of all: Make the Emacs code
> wider!
>
> Emacs has tried to keep the line width of the source code at 80
> characters since Emacs was created.  It was a good choice (perhaps the
> only) back then, but most screens are wide and short these days, and the
> folding contortions we have to do to make everything fit in 80
> characters is sometimes annoying, and leads to code that's awkward to
> read.
>
> So my suggestion is: Change the default to 100.

My difficulties for understanding Emacs sources are not related to
formatting to comply with the max line width rule, but to excessive
nesting levels and overly long functions.

Increasing line width is the wrong approach to fix this deeper problem,
because it would make it worse.




^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 14:09   ` Lars Ingebrigtsen
@ 2020-09-13 15:53     ` Stefan Kangas
  2020-09-13 16:21       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 45+ messages in thread
From: Stefan Kangas @ 2020-09-13 15:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> But I thought the current default was 70?  At least that's what
>> fill-column in .dir-locals.el indicates.  Is that only for docstrings
>> perhaps?
>
> Yes, that's for text only -- not just docstrings, but also comments and
> the like, I think?

Sorry if this is hijacking your thread, but shouldn't it better be 80
characters?



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 15:53     ` Stefan Kangas
@ 2020-09-13 16:21       ` Lars Ingebrigtsen
  2020-09-13 16:51         ` Yuan Fu
  2020-09-13 17:54         ` Stephen Leake
  0 siblings, 2 replies; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 16:21 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel

Stefan Kangas <stefankangas@gmail.com> writes:

> Sorry if this is hijacking your thread, but shouldn't it better be 80
> characters?

I think somebody decided at some point that 70 was the proper text with
for prose, and that's independent of what the screen looks like, or how
wide it is...

Perhaps it comes from email?  70 allow a few >>> rounds before the text
becomes too wide.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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:34           ` Eric Abrahamsen
  2020-09-13 17:54         ` Stephen Leake
  1 sibling, 2 replies; 45+ messages in thread
From: Yuan Fu @ 2020-09-13 16:51 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Stefan Kangas, emacs-devel

I work on a small laptop and it can fit two 75-column windows side-by-side, so I’d prefer the columns stay where there are right now. But that’s just yet another person who can’t give up on his habits, so…

Yuan


^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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
  1 sibling, 2 replies; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 16:58 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Stefan Kangas, emacs-devel

Yuan Fu <casouri@gmail.com> writes:

> I work on a small laptop and it can fit two 75-column windows
> side-by-side, so I’d prefer the columns stay where there are right
> now. But that’s just yet another person who can’t give up on his
> habits, so…

Hey, it's good to get data points on how people use Emacs.  It seems
like people these days like to keep as many Emacs frames as possible on
the screen horizontally, which makes sense.  And in that case increasing
the code width would make that more inconvenient.

I don't do that (I stack the frames under each other), though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 15:43 ` Óscar Fuentes
@ 2020-09-13 17:07   ` Amin Bandali
  2020-09-13 18:01   ` Stephen Leake
  1 sibling, 0 replies; 45+ messages in thread
From: Amin Bandali @ 2020-09-13 17:07 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: Lars Ingebrigtsen, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]

Óscar Fuentes writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Now for the most controversial suggestion of all: Make the Emacs code
>> wider!
>>
>> Emacs has tried to keep the line width of the source code at 80
>> characters since Emacs was created.  It was a good choice (perhaps the
>> only) back then, but most screens are wide and short these days, and the
>> folding contortions we have to do to make everything fit in 80
>> characters is sometimes annoying, and leads to code that's awkward to
>> read.
>>
>> So my suggestion is: Change the default to 100.
>
> My difficulties for understanding Emacs sources are not related to
> formatting to comply with the max line width rule, but to excessive
> nesting levels and overly long functions.
>
> Increasing line width is the wrong approach to fix this deeper problem,
> because it would make it worse.

Well said, I agree.

Also, as touched on by the others, the current line width allows me to
read two code windows side-by-side comfortably on my trusty X200, where
~160 characters fit on the screen horizontally.  Bumping the limit up to
100 characters would certainly take that away or make it much harder.

I'm in favour of keeping the line limits as they are for the time being.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 15:13     ` Eli Zaretskii
@ 2020-09-13 17:15       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 17:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> The default dimensions of the GUI frames we create.  Including the
> initial frame.  They should be wider, if we want the wide sources to
> look nicely on them, no?

Ah, I wasn't really thinking about changing anything for users -- people
who hack Emacs can change the frame width themselves (or not).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 15:01   ` Lars Ingebrigtsen
@ 2020-09-13 17:23     ` Andy Moreton
  2020-09-13 17:29       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 45+ messages in thread
From: Andy Moreton @ 2020-09-13 17:23 UTC (permalink / raw)
  To: emacs-devel

On Sun 13 Sep 2020, Lars Ingebrigtsen wrote:

> Daniel Martín <mardani29@yahoo.es> writes:
>
>> I don't agree with this suggestion, at least as it is written. If the
>> existing code won't change, then we will have parts of the codebase with
>> a different style than others. The goal of having a code style is not
>> much about the individual decisions, but about consistency.
>
> Nope -- in the Emacs tree, we're all about not making needless stylistic
> changes, really.  That's why we don't make white space changes, and we
> don't change one-form `if' statements into `when' across the board.

And this is exactly why changing line length is a bad idea. Any code
which requires overlong lines is usually clearer and more maintainable if
rewritten to use shorter lines, and helper routines if needed.

    AndyM





^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 17:23     ` Andy Moreton
@ 2020-09-13 17:29       ` Lars Ingebrigtsen
  2020-09-13 18:07         ` Göktuğ Kayaalp
  0 siblings, 1 reply; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 17:29 UTC (permalink / raw)
  To: Andy Moreton; +Cc: emacs-devel

Andy Moreton <andrewjmoreton@gmail.com> writes:

> And this is exactly why changing line length is a bad idea. Any code
> which requires overlong lines is usually clearer and more maintainable if
> rewritten to use shorter lines, and helper routines if needed.

We're definitely going in the opposite direction, though -- with the
introduction of lexical binding, the popular style is to create a bunch
of closures that refer to the surrounding environment, and that leads to
more nesting.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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
  2 siblings, 0 replies; 45+ messages in thread
From: Dmitry Gutov @ 2020-09-13 17:31 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

On 13.09.2020 18:27, Stefan Monnier wrote:
> PS: Yes, it's a joke, but I do think 80 columns is a better choice.
> Moving to 100 columns means I won't be able to see as many windows side
> by side on my screen.

100 columns would be ideal for me (for side by side windows), but if 80 
columns is what the majority could accept, it's still an improvement.



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 16:51         ` Yuan Fu
  2020-09-13 16:58           ` Lars Ingebrigtsen
@ 2020-09-13 17:34           ` Eric Abrahamsen
  1 sibling, 0 replies; 45+ messages in thread
From: Eric Abrahamsen @ 2020-09-13 17:34 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Lars Ingebrigtsen, Stefan Kangas, emacs-devel

Yuan Fu <casouri@gmail.com> writes:

> I work on a small laptop and it can fit two 75-column windows
> side-by-side, so I’d prefer the columns stay where there are right
> now. But that’s just yet another person who can’t give up on his
> habits, so…

I also typically work with side-by-side windows (I think it's more
important to see a larger vertical chunk of each file), and on my laptop
80 chars is already a squeeze. On the desktop it doesn't matter. 



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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
  2 siblings, 0 replies; 45+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2020-09-13 17:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

I'm also for staying on 80.

For practical reasons it force programmers to limit the max nesting
level, and that's a very good thing for maintainability.

  Andrea



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 16:21       ` Lars Ingebrigtsen
  2020-09-13 16:51         ` Yuan Fu
@ 2020-09-13 17:54         ` Stephen Leake
  1 sibling, 0 replies; 45+ messages in thread
From: Stephen Leake @ 2020-09-13 17:54 UTC (permalink / raw)
  To: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> Sorry if this is hijacking your thread, but shouldn't it better be 80
>> characters?
>
> I think somebody decided at some point that 70 was the proper text with
> for prose, and that's independent of what the screen looks like, or how
> wide it is...

That means indented comment paragraphs are narrower then unindented
ones; that gets very awkward at large indents.

In ada-mode, the width of a comment paragraph is independent of the
indent; I think that looks much better. The implementation sets
fill-column for each paragraph depending on indent, just before it is
filled.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 16:58           ` Lars Ingebrigtsen
@ 2020-09-13 17:55             ` Stephen Leake
  2020-09-13 18:04             ` arthur miller
  1 sibling, 0 replies; 45+ messages in thread
From: Stephen Leake @ 2020-09-13 17:55 UTC (permalink / raw)
  To: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Yuan Fu <casouri@gmail.com> writes:
>
>> I work on a small laptop and it can fit two 75-column windows
>> side-by-side, so I’d prefer the columns stay where there are right
>> now. But that’s just yet another person who can’t give up on his
>> habits, so…
>
> Hey, it's good to get data points on how people use Emacs.  It seems
> like people these days like to keep as many Emacs frames as possible on
> the screen horizontally, which makes sense.  And in that case increasing
> the code width would make that more inconvenient.

I work on a large desktop screen, with two 120 column frames, plus this
email frame, side-by-side.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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
  1 sibling, 1 reply; 45+ messages in thread
From: Stephen Leake @ 2020-09-13 18:01 UTC (permalink / raw)
  To: emacs-devel

Óscar Fuentes <ofv@wanadoo.es> writes:

> My difficulties for understanding Emacs sources are not related to
> formatting to comply with the max line width rule, but to excessive
> nesting levels and overly long functions.

Yes.

> Increasing line width is the wrong approach to fix this deeper problem,
> because it would make it worse.

It could, yes.

The counter argument is that wider lines make it easier to use longer,
more descriptive names; 'ada-goto-declaration-start' vs
'ada-to-decl-st', for example.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 45+ messages in thread

* RE: Changing line widths in the Emacs source code
  2020-09-13 16:58           ` Lars Ingebrigtsen
  2020-09-13 17:55             ` Stephen Leake
@ 2020-09-13 18:04             ` arthur miller
  1 sibling, 0 replies; 45+ messages in thread
From: arthur miller @ 2020-09-13 18:04 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Yuan Fu; +Cc: Stefan Kangas, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]

Just another user here; I am always fighting for vertical space on the screen, I am one of those that prefer buffers side by side. I don't like multiple frames, but I usually have one fEmacs rame taking one half of the screen and some other apo(s) on the other half. Then in Emacs I have usually two buffers side by side. So for me around 80 char per line is just perfect. 100 would probably be a bit too much.


-------- Originalmeddelande --------
Från: Lars Ingebrigtsen <larsi@gnus.org>
Datum: 2020-09-13 18:59 (GMT+01:00)
Till: Yuan Fu <casouri@gmail.com>
Kopia: Stefan Kangas <stefankangas@gmail.com>, emacs-devel <emacs-devel@gnu.org>
Ämne: Re: Changing line widths in the Emacs source code

Yuan Fu <casouri@gmail.com> writes:

> I work on a small laptop and it can fit two 75-column windows
> side-by-side, so I’d prefer the columns stay where there are right
> now. But that’s just yet another person who can’t give up on his
> habits, so…

Hey, it's good to get data points on how people use Emacs.  It seems
like people these days like to keep as many Emacs frames as possible on
the screen horizontally, which makes sense.  And in that case increasing
the code width would make that more inconvenient.

I don't do that (I stack the frames under each other), though.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no


[-- Attachment #2: Type: text/html, Size: 2163 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 17:29       ` Lars Ingebrigtsen
@ 2020-09-13 18:07         ` Göktuğ Kayaalp
  0 siblings, 0 replies; 45+ messages in thread
From: Göktuğ Kayaalp @ 2020-09-13 18:07 UTC (permalink / raw)
  To: emacs-devel; +Cc: Andy Moreton

On 2020-09-13 20:29 +03, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> We're definitely going in the opposite direction, though -- with the
> introduction of lexical binding, the popular style is to create a bunch
> of closures that refer to the surrounding environment, and that leads to
> more nesting.

Tangentially, is passing around environments something any programming
languages do? E.g.

(defun x (env)
  (using-environment env
    (message "I am %s" name surname)))

(defun y (name)
  (let ((surname "McCarthy"))
    (x (capture-environment-as-closure))))

(y "John")

That would be one cool feature to have in Elisp.

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



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 18:01   ` Stephen Leake
@ 2020-09-13 18:17     ` Göktuğ Kayaalp
  0 siblings, 0 replies; 45+ messages in thread
From: Göktuğ Kayaalp @ 2020-09-13 18:17 UTC (permalink / raw)
  To: emacs-devel

On 2020-09-13 21:01 +03, Stephen Leake <stephen_leake@stephe-leake.org> wrote:
> The counter argument is that wider lines make it easier to use longer,
> more descriptive names; 'ada-goto-declaration-start' vs
> 'ada-to-decl-st', for example.

80 char shouldn’t be a bottleneck for that, given Lisp lends itself well
to breaking up statements over lines in a bit more extreme fashion than
what other syntaxes allow before becoming unreadable.

IDK how popular it is but I like breaking things up over lines even if
names are in the smaller range.

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



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 14:22 ` Alan Mackenzie
@ 2020-09-13 18:38   ` Vladimir Sedach
  2020-09-13 20:13     ` Göktuğ Kayaalp
  2020-09-15  7:25     ` Stefan Kangas
  0 siblings, 2 replies; 45+ messages in thread
From: Vladimir Sedach @ 2020-09-13 18:38 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel


Alan Mackenzie <acm@muc.de> writes:

> It remains a good choice, now.  Wide text is more difficult to read.
> For that reason, newspaper columns (remember them?) were typically much
> less than 80 columns wide.

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.

> My Linux TTY screen is 240 characters wide and 67 lines high.  With that
> I can get Follow Mode three windows wide, giving me a total display of
> 195 contiguous lines of a single buffer.  There are only occasional
> lines which need to be wrapped.  This is very helpful, particularly
> whilst debugging.

I did a lot of testing in 2017, and found that even the lowest
resolution 16:9 laptop displays could show 3 columns of 70 character
wide text side-by-side, which works really well with Emacs and
particularly with EXWM.

I switched from 120 character line width for code to 70 columns
everywhere. The main motivation was that this allows more information
to be displayed on the screen, and easier buffer/EXWM window
navigation. What I found is that this actually improved code
legibility, and had the unexpected side-effect of making it easier to
include code in e-mails, documentation, and blog posts, improving
communication.

If anything, consider formatting your code to less than 80 characters
per line.

--
Vladimir Sedach
Software engineering services in Los Angeles https://oneofus.la



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 18:38   ` Vladimir Sedach
@ 2020-09-13 20:13     ` Göktuğ Kayaalp
  2020-09-13 20:52       ` Stefan Monnier
  2020-09-13 23:45       ` Óscar Fuentes
  2020-09-15  7:25     ` Stefan Kangas
  1 sibling, 2 replies; 45+ messages in thread
From: Göktuğ Kayaalp @ 2020-09-13 20:13 UTC (permalink / raw)
  To: emacs-devel; +Cc: Alan Mackenzie

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



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 20:13     ` Göktuğ Kayaalp
@ 2020-09-13 20:52       ` Stefan Monnier
  2020-09-13 21:23         ` Göktuğ Kayaalp
  2020-09-13 23:45       ` Óscar Fuentes
  1 sibling, 1 reply; 45+ messages in thread
From: Stefan Monnier @ 2020-09-13 20:52 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: Alan Mackenzie, emacs-devel

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

Indeed.  The 55-60 is for columns of actual text.
That leaves up to 25 columns of indentation in an 80-columns window.

> => "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.

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.


        Stefan




^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 20:52       ` Stefan Monnier
@ 2020-09-13 21:23         ` Göktuğ Kayaalp
  2020-09-14  0:08           ` Tim Cross
  0 siblings, 1 reply; 45+ messages in thread
From: Göktuğ Kayaalp @ 2020-09-13 21:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Göktuğ Kayaalp, Alan Mackenzie, emacs-devel

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



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 20:13     ` Göktuğ Kayaalp
  2020-09-13 20:52       ` Stefan Monnier
@ 2020-09-13 23:45       ` Óscar Fuentes
  2020-09-14  2:23         ` Stefan Monnier
  1 sibling, 1 reply; 45+ messages in thread
From: Óscar Fuentes @ 2020-09-13 23:45 UTC (permalink / raw)
  To: emacs-devel

Göktuğ Kayaalp <self@gkayaalp.com> writes:

> 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:

Keeping track of indentation level adds to cognitive load, so we can't
dismiss leading unused columns as irrelevant.




^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 21:23         ` Göktuğ Kayaalp
@ 2020-09-14  0:08           ` Tim Cross
  0 siblings, 0 replies; 45+ messages in thread
From: Tim Cross @ 2020-09-14  0:08 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: Alan Mackenzie, Stefan Monnier, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 2776 bytes --]

As a vision impaired coder, I prefer the 80 column width as it allows me to
have larger fonts and still see the whole line on a large monitor. However,
a more important data point might be the impact wider lines would have for
code examples and samples in blogs, ebooks and other formats. Such things
are typically formatted for reading and are usually formatted for 80
characters (or less). With longer source code lines, either smaller fonts
or re-formatting would be required.

Probably the most important data points against increased size is the
ability to display windows 'side by side' and the growth in mobile/laptop
environments, which typically have much smaller screens than desktops.

I am against this change.



On Mon, 14 Sep 2020 at 07:24, Göktuğ Kayaalp <self@gkayaalp.com> wrote:

> 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
>
>

-- 
regards,

Tim

--
Tim Cross

[-- Attachment #2: Type: text/html, Size: 3777 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 23:45       ` Óscar Fuentes
@ 2020-09-14  2:23         ` Stefan Monnier
  2020-09-14  2:28           ` T.V Raman
  0 siblings, 1 reply; 45+ messages in thread
From: Stefan Monnier @ 2020-09-14  2:23 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: emacs-devel

> Keeping track of indentation level adds to cognitive load, so we can't
> dismiss leading unused columns as irrelevant.

I don't think we was saying they're irrelevant.  But just that the 55-60
"optimum" has to do with the difficulty for your visual system to jump
from the end of one line to the beginning of the next and that it was in
a context of "plain text", so it doesn't necessarily carry over to code
because of the indentation.

The indentation could both help (in the sense that a text indented by 40
columns should be able to use a fill-column of about 95-100 and result
in an "optimal" legibility) and hinder (in the sense that it might be
harder for the visual system to find the beginning of the line when
every line starts at a different indentation level, tho I don't know if
that's the case, nor even if it has been studied).

In any case, my experience is that regardless of issues of legibility it
is usually easy to make code fit within 80 columns so I don't see
a strong reason to increase that number (given that such an increase
would likely result in a decrease of visual code density, i.e. less
efficient use of screen real estate, and may encourage nesting code more
deeply which would be detrimental to the readability of the code).

I don't think there's anything magical about 80, but experience just
seems to show that it works well.


        Stefan




^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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
  0 siblings, 2 replies; 45+ messages in thread
From: T.V Raman @ 2020-09-14  2:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Óscar Fuentes, emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 1966 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

This could also be language specific. Languages like Java and perhaps
also C++ end up with unduely long identifiers when you have a complex
package/module  system in use --- that then makes 80 columns hard.

Emacs C codebase doesn't suffer this, though elisp does to an extent
given that identifier names can get long if one isn't careful to choose
a succint package prefix in lieu of a namespace 

>> Keeping track of indentation level adds to cognitive load, so we can't
>> dismiss leading unused columns as irrelevant.
>
> I don't think we was saying they're irrelevant.  But just that the 55-60
> "optimum" has to do with the difficulty for your visual system to jump
> from the end of one line to the beginning of the next and that it was in
> a context of "plain text", so it doesn't necessarily carry over to code
> because of the indentation.
>
> The indentation could both help (in the sense that a text indented by 40
> columns should be able to use a fill-column of about 95-100 and result
> in an "optimal" legibility) and hinder (in the sense that it might be
> harder for the visual system to find the beginning of the line when
> every line starts at a different indentation level, tho I don't know if
> that's the case, nor even if it has been studied).
>
> In any case, my experience is that regardless of issues of legibility it
> is usually easy to make code fit within 80 columns so I don't see
> a strong reason to increase that number (given that such an increase
> would likely result in a decrease of visual code density, i.e. less
> efficient use of screen real estate, and may encourage nesting code more
> deeply which would be detrimental to the readability of the code).
>
> I don't think there's anything magical about 80, but experience just
> seems to show that it works well.
>
>
>         Stefan
>
>

-- 
7©4 Id: kg:/m/0285kf1  •0Ü8



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 13:45 Changing line widths in the Emacs source code Lars Ingebrigtsen
                   ` (6 preceding siblings ...)
  2020-09-13 15:43 ` Óscar Fuentes
@ 2020-09-14  3:50 ` Richard Stallman
  2020-09-14 19:25 ` David Koppelman
  2020-09-15  8:53 ` Lars Brinkhoff
  9 siblings, 0 replies; 45+ messages in thread
From: Richard Stallman @ 2020-09-14  3:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Now for the most controversial suggestion of all: Make the Emacs code
  > wider!

That will provide some convenience to people who use wide screens
but be a big problem for people who use narrow screens.
Overall, that amounts to a change for the worse.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-14  2:28           ` T.V Raman
@ 2020-09-14  7:42             ` tomas
  2020-09-14  9:59             ` Alan Third
  1 sibling, 0 replies; 45+ messages in thread
From: tomas @ 2020-09-14  7:42 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

On Sun, Sep 13, 2020 at 07:28:04PM -0700, T.V Raman wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 
> This could also be language specific. Languages like Java and perhaps
> also C++ end up with unduely long identifiers when you have a complex
> package/module  system in use --- that then makes 80 columns hard.

In the foreword to SICP [1], Alan Perlis writes

    "Algol 60, [...] lives inthe genes of Scheme and Pascal.
     [...]
     Pascal is for building pyramids -- imposing, breathtaking,
     static structures built by armies pushing heavy blocks
     into place. Lisp is for building organisms -- imposing,
     breathtaking, dynamic structures built by squads fitting
     fluctuating myriads of simpler organisms into place."

There was no Java or C++ around back then, but I think they fit
the "Pascal" pattern even better than Pascal itself.

Pyramids are built, remember, of huge stone blocks.

Cheers
[1] https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-5.html#%_chap_Temp_2
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-14  2:28           ` T.V Raman
  2020-09-14  7:42             ` tomas
@ 2020-09-14  9:59             ` Alan Third
  1 sibling, 0 replies; 45+ messages in thread
From: Alan Third @ 2020-09-14  9:59 UTC (permalink / raw)
  To: T.V Raman; +Cc: Óscar Fuentes, Stefan Monnier, emacs-devel

On Sun, Sep 13, 2020 at 07:28:04PM -0700, T.V Raman wrote:
> This could also be language specific. Languages like Java and perhaps
> also C++ end up with unduely long identifiers when you have a complex
> package/module  system in use --- that then makes 80 columns hard.
> 
> Emacs C codebase doesn't suffer this, 

You should have a look at the src/*.m files sometime. ;)
-- 
Alan Third



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 13:45 Changing line widths in the Emacs source code Lars Ingebrigtsen
                   ` (7 preceding siblings ...)
  2020-09-14  3:50 ` Richard Stallman
@ 2020-09-14 19:25 ` David Koppelman
  2020-09-15  8:53 ` Lars Brinkhoff
  9 siblings, 0 replies; 45+ messages in thread
From: David Koppelman @ 2020-09-14 19:25 UTC (permalink / raw)
  To: emacs-devel

Keep it at 80 columns, it's a widely adopted standard.

I keep my Emacs frames 80 columns wide because that fits many coding
styles, including my own work. I'd hate to see all those line
continuation characters when visiting elisp files.

I don't think there's any way to agree on an optimal width for E-lisp
code, or for material in other languages. Too large a width will tire
those reading code, the same holds for text (as someone here pointed
out), which is why newspaper columns are narrow.

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Now for the most controversial suggestion of all: Make the Emacs code
> wider!
>
> Emacs has tried to keep the line width of the source code at 80
> characters since Emacs was created.  It was a good choice (perhaps the
> only) back then, but most screens are wide and short these days, and the
> folding contortions we have to do to make everything fit in 80
> characters is sometimes annoying, and leads to code that's awkward to
> read.
>
> So my suggestion is: Change the default to 100.
>
> (This, of course, doesn't mean that we change any of the existing code,
> but we stop formatting all new code to fit within 80 columns, and
> instead aim for 100 instead.)



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 18:38   ` Vladimir Sedach
  2020-09-13 20:13     ` Göktuğ Kayaalp
@ 2020-09-15  7:25     ` Stefan Kangas
  1 sibling, 0 replies; 45+ messages in thread
From: Stefan Kangas @ 2020-09-15  7:25 UTC (permalink / raw)
  To: Vladimir Sedach, Alan Mackenzie; +Cc: emacs-devel

Vladimir Sedach <vas@oneofus.la> 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.

For published books?  On dead trees (a.k.a. "paper")?  Sure.  But note
that this optimal figure could go as high as 75 characters depending on
which source you quote.

I personally haven't seen any research that shows that what is
applicable to reading prose or newspaper copy in print is also
applicable to reading and understanding code on a screen.  I would have
assumed that these cases are different.  Just to give one example,
monospace fonts are a nightmare to read in a book but works well for
code.

(In any case, this proposal seems impopular enough that it's unlikely to
happen.  Oh, well.)



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  2020-09-13 13:45 Changing line widths in the Emacs source code Lars Ingebrigtsen
                   ` (8 preceding siblings ...)
  2020-09-14 19:25 ` David Koppelman
@ 2020-09-15  8:53 ` Lars Brinkhoff
  9 siblings, 0 replies; 45+ messages in thread
From: Lars Brinkhoff @ 2020-09-15  8:53 UTC (permalink / raw)
  To: emacs-devel

Lars Ingebrigtsen wrote:
> Emacs has tried to keep the line width of the source code at 80
> characters since Emacs was created.

Historical side note: The AI Lab PDP-10 on which the first Emacs was
created had Datapoint 3300 terminals that were 72 characters wide.




^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: Changing line widths in the Emacs source code
  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
  2 siblings, 0 replies; 45+ messages in thread
From: jeremyb @ 2020-09-16  6:42 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel


BTW, for e-ink monitors (smaller than standard monitors), 80 columns is what fits.

Stefan Monnier writes:

>> So my suggestion is: Change the default to 100.
>
> Heresy!
>
>
>         Stefan
>
>
> PS: Yes, it's a joke, but I do think 80 columns is a better choice.
> Moving to 100 columns means I won't be able to see as many windows side
> by side on my screen.




^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2020-09-16  6:42 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).