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

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

Re: Tab width oddity


From: Emanuel Berg
Subject: Re: Tab width oddity
Date: Wed, 24 Sep 2014 01:20:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Nate Bargmann <address@hidden> writes:

> For most lines this lines up just fine but for some
> the '=' is positioned at a tab-stop -1 (position 7,
> 15, 23, etc) and the next character in the source
> file is a tab (0x09). The character immediately
> following is also a tab. Editors such as Vim and
> Midnight Commander only give the tab character one
> blank in this position and give the following tab the
> customary 8 blanks (per my settings). However, Emacs
> is expanding the first tab to 9 blanks before showing
> the second tab character. I do not see this occurring
> when a tab character is two or more characters to the
> left of the tab stop. I first became aware of this
> when I found things were not lined up in Emacs as I
> had expected and a git diff' showed that my changes
> had moved the assignment operand to the left by one
> tab stop.

This is difficult to understand. Can you include the
code that behaves strange so I (we) can try to
reproduce it?

I never thought about tabs in the context of
indentation (or the c-mode), but in general I don't
like tabs and I have made it so they are automatically
replaced by spaces on save-buffer.

This is what I have on tabs:

(setq-default tab-width 3)

(defun untab-all ()
  (if (not (member major-mode '(makefile-gmake-mode
                                makefile-mode) )) ; exceptions
      (untabify (point-min) (point-max)) )
  nil) ; tell 'did not write buffer to disk'

(setq before-save-hook '(untab-all delete-trailing-whitespace))

The reason for the exceptions are that 'make' wants
tabs in Makefiles. And that's the only time I ever use
them.

-- 
underground experts united


reply via email to

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