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

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

Re: replacement for whitespace-tab


From: Nick Helm
Subject: Re: replacement for whitespace-tab
Date: Tue, 24 Oct 2017 22:31:18 +1300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (darwin)

On Tue, 24 Oct 2017, Will Parsons wrote:

> Yes, yes - I basically agree with you about the use of tabs, but for
> various reasons (including that the code may not be one's own) one
> doesn't necessarily want just replace them, but actually know where
> they are - and that is the purpose of the question.

You can use the built-in whitespace library to change the way Emacs
displays characters, including tabs, on screen.

One of the faces defined in this library – whitespace-tab – determines
how tabs look when the mode is active. A variable by the same name used
to do the same job.

To change the way tabs look, put something like this in your .emacs and
restart:

  (require 'whitespace)
  (setq whitespace-style '(face tabs)) ;this enables faces for tabs
  (set-face-attribute 
    'whitespace-tab nil :inherit 'default     
                        :foreground "red"
                        :underline t)

Then turn the mode on with (repeat to turn it off again):

  M-x global-whitespace-mode RET 

This will add a red underline to tabs in all your buffers. You can also
remap tabs to another character, such as a right arrow, but this
involves more than just faces.

In both cases (faces and remapping) Emacs shows an on-screen
representation only – your buffers and the contents of your files retain
all their original tabs.

--
Nick



reply via email to

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