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

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

RE: How to show all characters in a specific line


From: Drew Adams
Subject: RE: How to show all characters in a specific line
Date: Wed, 31 Dec 2014 19:17:40 -0800 (PST)

> `whitespace-mode' seems to do all I wanted and compared to
> `highlight-chars', it is much more readable since it doesn't just
> put a fairly opaque blob of color where a tab is used.
> 
> (I realize the face is customizable... but by default its fairly
> blotto looking to read)

The default color for the TAB-highlighting face is a pale yellow
or off-white background (`LemonChiffon').

> `whitespace-mode' puts an icon of sorts: >> but smaller, for tab and
> . for space.  All on a background color of a medium dark grey.
> 
> Mush easier on the eyes and easier to ascertain immediately what has
> been put down.
> 
> But still (And no religious scrap intended) neither of those is
> really as readable and handy as vim's :l  Which puts only an icon
> in the place of \t (^I). It collapses the whitespace and puts a
> series of ^I for however many \t were used.

To get that effect, all you need to do is to tell Emacs to treat
TAB the same way it treats other control characters (except newline):

(aset (window-display-table) 9
      (vector (make-glyph-code ?^ 'escape-glyph)
              (make-glyph-code (+ 9 64) 'escape-glyph)))

You can use whatever display table you like in place of
`(window-display-table)' - for example, you can create your own
or you can change `standard-display-table'.

That code is taken from the Elisp manual, node `Display Tables'.
9 is the value of a TAB character (`C-i').

> I don't think a snippet of whitespace-mode or hightlight-chars will
> survive mail incoding without creating some kind of image of it, but
> the vim look is just common keyboard characters with no higlight:
> 
> This:
>  rsync_short_args  -avlR
>  rsync_long_args   --stats  --delete --numeric-ids  --delete-
> excluded
> 
> Becomes:
>  rsync_short_args^I-avlR$
>  rsync_long_args^I--stats^I--delete^I--numeric-ids^I--delete-
> excluded$

See above.  That is how Emacs treats control characters generally,
except for newline and TAB, provided your option `ctl-arrow' is
non-nil.



reply via email to

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