unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Harry Putnam <reader@newsguy.com>, help-gnu-emacs@gnu.org
Subject: RE: How to show all characters in a specific line
Date: Wed, 31 Dec 2014 19:17:40 -0800 (PST)	[thread overview]
Message-ID: <767948ac-03d6-4203-b133-91fb8cb30757@default> (raw)
In-Reply-To: <87wq571de9.fsf@reader.local.lan>

> `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	other threads:[~2015-01-01  3:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-31 21:16 How to show all characters in a specific line Harry Putnam
2014-12-31 22:09 ` Drew Adams
2015-01-01  1:46   ` Harry Putnam
2015-01-01  3:17     ` Drew Adams [this message]
2015-01-04 13:19       ` Harry Putnam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=767948ac-03d6-4203-b133-91fb8cb30757@default \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=reader@newsguy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).