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: Fri, 10 Jun 2022 10:50:04 +0300

> Date: Fri, 10 Jun 2022 07:42:19 +0000
> From: goncholden <goncholden@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
> 
> > I think your current views are because you are trying to fight Emacs
> > features instead of using them to your benefit. Why do you need to
> > insert literal TABs so much? You never explained that.
> 
> It usually happens with legacy code where people used tabs most times.  Then 
> if the setting in for spaces, the file would end with a mix of tabs and 
> spaces.  Indentation could get mixed up this way.  What could be a solution?  
> Still with 'C-q TAB' ?

One solution is to mark the portion of the buffer (or the entire
buffer), then use either "M-x tabify" (if you want to have a mix of
TABs and SPACEs) or "M-x untabify" (if you want to have only SPACEs).
After you do one of these, the setting of indent-tabs-mode will take
care of the new/modified code.

Another possibility, for the code where each indentation level is made
only out of TABs, is to set the indentation levels to correspond to
the existing code.  Then TAB will always insert only literal TAB
characters, due to the setting of tab stops.

I'm not yet sure I understand what situation you describe, so the
answer is somewhat ambiguous and imprecise.  I suggest to tell more
and perhaps show an example, so that the advice could be more to the
point.



reply via email to

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