unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Should indent-tabs-mode insert tabs only leading whitespace?
@ 2020-07-17 17:52 Daniel Colascione
  2020-07-17 18:10 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Colascione @ 2020-07-17 17:52 UTC (permalink / raw)
  To: emacs-devel

I recently debugged a weird interaction between make-mode and
ws-butler-mode that let to random tab characters being strewn in my
makefiles: ws-butler-mode uses move-to-column after save to restore
trailing whitespace on the line containing point. move-to-column calls
indent-to to actually do the move. And because makefile-mode sets
indent-tabs-mode, that indent-to inserts tabs sometimes, resulting in
stray tab files in places where they don't belong.

There are lots of fixes for this problem, but the fundamental issue seems
to be that indent-to inserts tab characters for column alignment *after*
non-whitespace characters on a given line. What if indent-to always
inserted spaces when there were non-whitespace characters between BOL and
point? That whitespace manipulation isn't really indentation.




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

* Re: Should indent-tabs-mode insert tabs only leading whitespace?
  2020-07-17 17:52 Should indent-tabs-mode insert tabs only leading whitespace? Daniel Colascione
@ 2020-07-17 18:10 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2020-07-17 18:10 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: emacs-devel

> There are lots of fixes for this problem, but the fundamental issue seems
> to be that indent-to inserts tab characters for column alignment *after*
> non-whitespace characters on a given line. What if indent-to always
> inserted spaces when there were non-whitespace characters between BOL and
> point? That whitespace manipulation isn't really indentation.

AFAIK `indent-to` is a low-level function that is used for indentation
indeed but is also used for alignment and many other purposes, so
changing it as you suggested will likely lead to undesired behaviors in
some cases.

So I think this should be fixed elsewhere or at least be conditional on
some new variable setting (e.g. `indent-tab-mode` set to `only-at-bol`).


        Stefan




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

end of thread, other threads:[~2020-07-17 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-17 17:52 Should indent-tabs-mode insert tabs only leading whitespace? Daniel Colascione
2020-07-17 18:10 ` Stefan Monnier

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