This is useful, but I prefer HEX base instead octal.
How can I change this behavior.
To hard find right keywords for search in manual and Google ((
As a special case, if the character lies in the range 128 (0200
octal) through 159 (0237 octal), it stands for a "raw" byte that does
not correspond to any specific displayable character. Such a
"character" lies within the `eight-bit-control' character set, and is
displayed as an escaped octal character code. In this case, `C-x ='
shows `part of display ...' instead of `file'.
I want change with behavior from octal to hex.
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.
Stefan
What is the reasoning behind displaying it in octal rather than
decimal or hexadecimal in the first place? I didn't know people cared
about octals anymore.
--
Deniz Dogan
I read on Wikipedia: "Octal representation of non-ASCII bytes may be
particularly handy with UTF-8, where any start byte has octal value
\3nn and any continuation byte has octal value \2nn."
Is this the reason perhaps?
--
Deniz Dogan
> What is the reasoning behind displaying it in octal rather than
> decimal or hexadecimal in the first place? I didn't know people cared
> about octals anymore.
I think it's historical. The original MIT developers tended to use
octal more than hex.
--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
> I read on Wikipedia: "Octal representation of non-ASCII bytes may be
> particularly handy with UTF-8, where any start byte has octal value
> \3nn and any continuation byte has octal value \2nn."
>
> Is this the reason perhaps?
Certainly not! GNU Emacs was octal before someone imagined "Unicode"...
It comes from sparse memory. One byte is two nibbles! (1 € is almost 2
ancient DM.) UNIX file permissions are octal. C is great in shifting
bits around.
--
Greetings
Pete
Almost anything is easier to get into than out of.
– Allen's Law
As mentioned by someone else, this goes back to the beginning of Emacs,
so we're talking >20 years ago. IIUC octal was more common back then.
There are still some advantages to using octal: e.g., by using fewer
different chars, there is a higher likelihood that the boundary of the
\NNN sequence will be self obvious: when you see \01234, it's not
obvious that it's \012 followed by 3 and 4, but when you see \012ab the
boundary is self-evident. With hexadecimal, the cases where the
boundary is not self-evident are more common.
Stefan
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.
(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 (make-glyph-code ?\\ 'escape-glyph)
(make-glyph-code ?x 'escape-glyph)
(make-glyph-code hi 'escape-glyph)
(make-glyph-code low 'escape-glyph)))
(setq i (+ i 1))))
-- Stefan
glyphs is interesting concept which I don't know.