unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Indentation style (was: [PATCH] notmuch-dump.c: Fix output file being closed twice)
@ 2019-07-28 13:33 Ralph Seichter
  2019-07-28 20:36 ` David Bremner
  0 siblings, 1 reply; 10+ messages in thread
From: Ralph Seichter @ 2019-07-28 13:33 UTC (permalink / raw)
  To: notmuch

* David Bremner:

> I did have to revert one unrelated whitespace change.

I knew I might run afoul of that the minute I read "Indent is 4 spaces
with mixed tab/spaces and a tab width of 8" in the code style notes. ;-)

In my experience, it is error-prone to mix tabs and spaces. Perhaps it
would be useful to change to all spaces? Also, with an added editor mode
line, supporting that style would be more convenient (for Emacs and Vim
at least).

-Ralph

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

* Re: Indentation style (was: [PATCH] notmuch-dump.c: Fix output file being closed twice)
  2019-07-28 13:33 Indentation style (was: [PATCH] notmuch-dump.c: Fix output file being closed twice) Ralph Seichter
@ 2019-07-28 20:36 ` David Bremner
  2019-07-28 22:19   ` Indentation style Thomas Schneider
  0 siblings, 1 reply; 10+ messages in thread
From: David Bremner @ 2019-07-28 20:36 UTC (permalink / raw)
  To: Ralph Seichter, notmuch

Ralph Seichter <abbot@monksofcool.net> writes:

> * David Bremner:
>
>> I did have to revert one unrelated whitespace change.
>
> I knew I might run afoul of that the minute I read "Indent is 4 spaces
> with mixed tab/spaces and a tab width of 8" in the code style notes. ;-)
>
> In my experience, it is error-prone to mix tabs and spaces. Perhaps it
> would be useful to change to all spaces? Also, with an added editor mode
> line, supporting that style would be more convenient (for Emacs and Vim
> at least).

We're using more or less the default for Emacs (you can see the details
in .dir-locals.el).  I'm a bit dubious that we want to re-whitespace
everything, but I'd certainly be receptive to matching configuration for
other editors. Does anyone know if vim indentation can be configured per
project / directory?

d

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

* Re: Indentation style
  2019-07-28 20:36 ` David Bremner
@ 2019-07-28 22:19   ` Thomas Schneider
  2019-07-29  0:56     ` Daniel Kahn Gillmor
  2019-07-29  1:13     ` David Bremner
  0 siblings, 2 replies; 10+ messages in thread
From: Thomas Schneider @ 2019-07-28 22:19 UTC (permalink / raw)
  To: David Bremner; +Cc: Ralph Seichter, notmuch

David Bremner <david@tethera.net> writes:

> We're using more or less the default for Emacs (you can see the details
> in .dir-locals.el).

Maybe I misunderstood, but this doesn’t really look like Emacs’ defaults
for C.

> I'm a bit dubious that we want to re-whitespace everything, but I'd
> certainly be receptive to matching configuration for other
> editors. Does anyone know if vim indentation can be configured per
> project / directory?

Yes, if you let Vim parse a per-directory .vimrc (similar to forbidding
Emacs to parse .dir-locals.el).

While we’re at it, how about a generic .editorconfig?  The world isn’t
split into good people and dea… uh, Emacs and Vim.

	--qsx

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

* Re: Indentation style
  2019-07-28 22:19   ` Indentation style Thomas Schneider
@ 2019-07-29  0:56     ` Daniel Kahn Gillmor
  2019-07-29 14:52       ` David Bremner
  2019-07-29 21:23       ` Tomi Ollila
  2019-07-29  1:13     ` David Bremner
  1 sibling, 2 replies; 10+ messages in thread
From: Daniel Kahn Gillmor @ 2019-07-29  0:56 UTC (permalink / raw)
  To: Thomas Schneider, David Bremner; +Cc: notmuch

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

On Mon 2019-07-29 00:19:48 +0200, Thomas Schneider wrote:
> Maybe I misunderstood, but this doesn’t really look like Emacs’ defaults
> for C.

I think the question is less "emacs defaults" vs. "consistency with the
current codebase".

> While we’re at it, how about a generic .editorconfig?  The world isn’t
> split into good people and dea… uh, Emacs and Vim.

Anyone who submits a .editorconfig that allows us to drop .dir-locals.el
would get enthusiastic support from me.  notmuch has been a very
emacs-focused project for years, but it doesn't need to be, and generic
editor configuration rules are preferable to editor-specific rules.

here's what i suspect such an editorconfig would look like given our
current codebase, but i haven't tested it or tried to apply the changes
to the notmuch codebase and see if it changes anything.

----------------------
root = true
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.{c,h,cpp,sh,el}]
tab_width = 8
indent_style = tab
indent_size = 4
----------------------

That said, i don't know how to represent (fill-column . 70) in
editorconfig syntax (see e0d85656da7f4d6e7d0b66a7bece39724143bffe for
justification), or (c-file-style . "linux").

(fwiw, i would also be happy if we moved away from literal tabs and just
used spaces-only.  But i am not interested in setting off a flamewar,
so if anyone prefers the mixed-tabs-and-spaces situation we are in
today, i will never mention this again)

       --dkg


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

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

* Re: Indentation style
  2019-07-28 22:19   ` Indentation style Thomas Schneider
  2019-07-29  0:56     ` Daniel Kahn Gillmor
@ 2019-07-29  1:13     ` David Bremner
  1 sibling, 0 replies; 10+ messages in thread
From: David Bremner @ 2019-07-29  1:13 UTC (permalink / raw)
  To: Thomas Schneider; +Cc: Ralph Seichter, notmuch

Thomas Schneider <qsx@chaotikum.eu> writes:

> David Bremner <david@tethera.net> writes:
>
>> We're using more or less the default for Emacs (you can see the details
>> in .dir-locals.el).
>
> Maybe I misunderstood, but this doesn’t really look like Emacs’ defaults
> for C.

Right, I should have been more precise, using tabs at the beginning of
the line, with tab-width 8, followed by less than 8 spaces is the emacs
default.

>
> Yes, if you let Vim parse a per-directory .vimrc (similar to forbidding
> Emacs to parse .dir-locals.el).
>
> While we’re at it, how about a generic .editorconfig?  The world isn’t
> split into good people and dea… uh, Emacs and Vim.

Sure, if someone is willing to provide .vimrc / .editorconfig, and
support it at least till we shake the bugs out, then I'm happy to
include them.

d

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

* Re: Indentation style
  2019-07-29  0:56     ` Daniel Kahn Gillmor
@ 2019-07-29 14:52       ` David Bremner
  2019-07-29 21:23       ` Tomi Ollila
  1 sibling, 0 replies; 10+ messages in thread
From: David Bremner @ 2019-07-29 14:52 UTC (permalink / raw)
  To: Daniel Kahn Gillmor; +Cc: notmuch

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

>
> (fwiw, i would also be happy if we moved away from literal tabs and just
> used spaces-only.  But i am not interested in setting off a flamewar,
> so if anyone prefers the mixed-tabs-and-spaces situation we are in
> today, i will never mention this again)
>

I mostly don't care, but the diff this would generate is daunting.

d

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

* Re: Indentation style
  2019-07-29  0:56     ` Daniel Kahn Gillmor
  2019-07-29 14:52       ` David Bremner
@ 2019-07-29 21:23       ` Tomi Ollila
  2019-07-30 13:09         ` Daniel Kahn Gillmor
  2019-07-30 13:37         ` Ralph Seichter
  1 sibling, 2 replies; 10+ messages in thread
From: Tomi Ollila @ 2019-07-29 21:23 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Thomas Schneider, David Bremner; +Cc: notmuch

On Sun, Jul 28 2019, Daniel Kahn Gillmor wrote:

>
> (fwiw, i would also be happy if we moved away from literal tabs and just
> used spaces-only.  But i am not interested in setting off a flamewar,
> so if anyone prefers the mixed-tabs-and-spaces situation we are in
> today, i will never mention this again)

I like mixed tabs and spaces. for example cursor moves faster...

>
>        --dkg

Tomi

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

* Re: Indentation style
  2019-07-29 21:23       ` Tomi Ollila
@ 2019-07-30 13:09         ` Daniel Kahn Gillmor
  2019-07-30 13:37         ` Ralph Seichter
  1 sibling, 0 replies; 10+ messages in thread
From: Daniel Kahn Gillmor @ 2019-07-30 13:09 UTC (permalink / raw)
  To: Tomi Ollila, Thomas Schneider, David Bremner; +Cc: notmuch

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

On Tue 2019-07-30 00:23:16 +0300, Tomi Ollila wrote:
> On Sun, Jul 28 2019, Daniel Kahn Gillmor wrote:
>> (fwiw, i would also be happy if we moved away from literal tabs and just
>> used spaces-only.  But i am not interested in setting off a flamewar,
>> so if anyone prefers the mixed-tabs-and-spaces situation we are in
>> today, i will never mention this again)
>
> I like mixed tabs and spaces. for example cursor moves faster...

Consider my proposal withdrawn :)

         --dkg

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

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

* Re: Indentation style
  2019-07-29 21:23       ` Tomi Ollila
  2019-07-30 13:09         ` Daniel Kahn Gillmor
@ 2019-07-30 13:37         ` Ralph Seichter
  2019-07-31 10:58           ` Tomi Ollila
  1 sibling, 1 reply; 10+ messages in thread
From: Ralph Seichter @ 2019-07-30 13:37 UTC (permalink / raw)
  To: notmuch

* Tomi Ollila:

> I like mixed tabs and spaces. for example cursor moves faster...

If that's the case, you're just not using the right keys to move around
the source code. :-) In Vim, keys like W/B, +/- etc. ignore whitespaces
anyway, and Emacs has equivalents. Rumour has it there are other editors
out in the wild, but then, some people believe anything... ;-)

I am aware this is a sensitive subject, but looking at the last 35+
years, I personally found that the only reliable way to avoid whitespace
related hassle is to stick to spaces only. I am not in a position to
decide this, of course, but I am glad that Python [1] even comes with a
command line option which turns mixed indentation into errors, making it
easy to spot these situations.

-Ralph

[1] https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces

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

* Re: Indentation style
  2019-07-30 13:37         ` Ralph Seichter
@ 2019-07-31 10:58           ` Tomi Ollila
  0 siblings, 0 replies; 10+ messages in thread
From: Tomi Ollila @ 2019-07-31 10:58 UTC (permalink / raw)
  To: Ralph Seichter, notmuch

On Tue, Jul 30 2019, Ralph Seichter wrote:

> * Tomi Ollila:
>
>> I like mixed tabs and spaces. for example cursor moves faster...
>
> If that's the case, you're just not using the right keys to move around
> the source code. :-) In Vim, keys like W/B, +/- etc. ignore whitespaces
> anyway, and Emacs has equivalents.

Perhaps... I just use arrow keys (no longer need to press c-p, c-n, c-b,
c-f so often ;D) and I can intuitively estimate how to use the keys to get
to a certain row-col position in emacs buffer -- and w/ tabs that usually
requires less keypresses... I've sometimes pressed M-b and M-f to move
over words but...

That's what leads to my opinion, which may or may not be general truth >;) 


> Rumour has it there are other editors
> out in the wild, but then, some people believe anything... ;-)
>
> I am aware this is a sensitive subject, but looking at the last 35+
> years, I personally found that the only reliable way to avoid whitespace
> related hassle is to stick to spaces only. 

I have only 30 years of experience in this (in 80's I did not have access
such machines where this would have been issue), so I have not had much
hassle with this (only when someone decides that tabs have only 4 character
width)

> I am not in a position to decide this, of course,

usually status quo prevails unless there is enough desire to change things
(preferably with good patches, when applicable)...

> but I am glad that Python [1] even comes with a
> command line option which turns mixed indentation into errors, making it
> easy to spot these situations.

What I've noticed python3 always fails if there is mixed tabs and spaces
used for indentation (used mg(1) in embedded device to patch python file);
I don't know whether indentation w/ tabs only would have worked there...

>
> -Ralph
>
> [1] https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces

Hmm, pep8(1) has originally been checking just tabs and spaces?
No wonder it is being renamed to pycodestyle :D

Tomi

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

end of thread, other threads:[~2019-07-31 10:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-28 13:33 Indentation style (was: [PATCH] notmuch-dump.c: Fix output file being closed twice) Ralph Seichter
2019-07-28 20:36 ` David Bremner
2019-07-28 22:19   ` Indentation style Thomas Schneider
2019-07-29  0:56     ` Daniel Kahn Gillmor
2019-07-29 14:52       ` David Bremner
2019-07-29 21:23       ` Tomi Ollila
2019-07-30 13:09         ` Daniel Kahn Gillmor
2019-07-30 13:37         ` Ralph Seichter
2019-07-31 10:58           ` Tomi Ollila
2019-07-29  1:13     ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.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).