From: Oleksandr Gavenko <gavenko@bifit.com.ua>
To: help-gnu-emacs@gnu.org
Subject: Re: How switch from escaped octal character code to escaped HEX?
Date: Tue, 11 Jan 2011 12:23:38 +0200 [thread overview]
Message-ID: <ighb39$mub$1@dough.gmane.org> (raw)
In-Reply-To: <jwvipy6fwnt.fsf-monnier+gnu.emacs.help@gnu.org>
On 03.01.2011 6:23, Stefan Monnier wrote:
>>> When Emacs find that byte that does
>>> not correspond to any specific displayable character it display
>>> octal codes instead, like: \276 (and with different color).
>>>
>>> This is useful, but I prefer HEX base instead octal.
>
> There is no direct/easy way to do it.
> But you can do it by adding the corresponding 128 entries to the
> standard-display-table.
>
> E.g.
>
> (setq standard-display-table (make-display-table))
> (aset standard-display-table (unibyte-char-to-multibyte 131)
> [?\\ ?x ?8 ?3])
> (aset standard-display-table (unibyte-char-to-multibyte 132)
> [?\\ ?x ?8 ?4])
>
> Should make the bytes 131 and 132 be displayed as \x83 and \x84 rather
> than \203 and \204.
>
Thanks Stefan for tips.
I read docs for 'buffer-display-table'. Here said:
For example, (aset buffer-display-table ?X [?Y]) tells Emacs
to display a capital Y instead of each X character.
So if in one encoding (cp1251) letter - й, in another (row-text) - \351.
I set:
(aset standard-display-table (unibyte-char-to-multibyte ?\xe9) [?\\ ?x
?e ?9])
but in cp1251 it properly displayed like й, in row-text - \xe9. I
afraid that it
in all case must be \xe9, but not. This is nice!
With this behavior I make I wont. Only one problem.
In GUI Emacs octal codes colorized (some thins red color,
C-u C-x = don't give font properties).
New hex values is not colorized. How make this?
PS. To make all 128 chars in hex I wrote:
(setq standard-display-table (make-display-table))
(let ( (i ?\x80) hex hi low )
(while (<= i ?\xff)
(setq hex (format "%x" i))
(setq hi (elt hex 0))
(setq low (elt hex 1))
(aset standard-display-table (unibyte-char-to-multibyte i) (vector
?\\ ?x hi low))
(setq i (+ i 1))
) )
PPS. Noel Evans send to me private mail where hi suggest:
(setq read-quoted-char-radix 16)
I already have this settings a lot of years. It allow you type byte in
hex: C-q 9 9 RET.
next prev parent reply other threads:[~2011-01-11 10:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-28 15:39 How switch from escaped octal character code to escaped HEX? Oleksandr Gavenko
2010-12-28 15:51 ` Oleksandr Gavenko
[not found] ` <mailman.6.1293551515.18545.help-gnu-emacs@gnu.org>
2011-01-03 4:23 ` Stefan Monnier
2011-01-03 7:14 ` Deniz Dogan
2011-01-03 10:13 ` Deniz Dogan
2011-01-03 14:37 ` Peter Dyballa
2011-01-04 4:03 ` Stefan Monnier
[not found] ` <mailman.8.1294038895.27854.help-gnu-emacs@gnu.org>
2011-01-03 13:42 ` Barry Margolin
2011-01-11 10:23 ` Oleksandr Gavenko [this message]
[not found] ` <mailman.0.1294741438.20926.help-gnu-emacs@gnu.org>
2011-01-11 17:34 ` Stefan Monnier
2011-01-12 9:22 ` Oleksandr Gavenko
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='ighb39$mub$1@dough.gmane.org' \
--to=gavenko@bifit.com.ua \
--cc=help-gnu-emacs@gnu.org \
/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).