help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Spaces rather than tabs by a major mode hook


From: Eli Zaretskii
Subject: Re: Spaces rather than tabs by a major mode hook
Date: Sun, 12 Jun 2022 09:40:01 +0300

> Date: Sat, 11 Jun 2022 20:02:57 +0000
> From: goncholden <goncholden@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
> 
> > Emacs requires you to customize, once, the indentation so that it
> > could thereafter help you by indenting everything automatically to
> > suit the indentation style. That's a win by any measure.
> 
> That the problem you are taking ages to understand.  "Emacs requires you to 
> customize", the origin of the problem.

No, it isn't the problem.  It is the solution to many problems,
whereby people use many different coding styles in their programs.  It
is impossible to provide good indentation support for any arbitrary
style, so if you happen to need to work with non-standard style, you
need to tell Emacs about that style.

> > > The question about how many columns should each construct be indented, 
> > > has no answer.
> >
> >
> > It should be possible to answer that question by just examining the
> > file you posted.
> 
> No, because there are thousands of files.

Are they using different styles?  If so, my suggestion is to reformat
them to the default style supported by Emacs out of the box, before
you start editing.

> > Alternatively, you could just reindent the entire file according to
> > the defaults, like this:
> >
> > C-x h
> > C-M-\
> >
> > and then keep making changes without any customizations.
> 
> That would destroy the possibilities of easily detecting code changes.

Detecting code changes is nowadays the job of a VCS.  A modern VCS can
easily show you changes other than whitespace changes.  Or you can
commit the reformatted but otherwise unchanged source first, and then
examine the changes relative to that.

> The mantra that things can always be customised implies observance to a 
> single formatting scheme.  Legacy code does not even subscribe to that.  They 
> only had simple editors.  If I introduce tabs with
> "C-q TAB", all those tabs get removed by emacs as soon as one presses return 
> at the end of the line.
> 
> Emacs is acting like a dictator.

If Emacs doesn't satisfy your needs, you are free to use another
editor, aren't you?



reply via email to

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