aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2017-06-01 21:24:15 +0300
committerEli Zaretskii2017-06-01 21:24:15 +0300
commite5de79992a22f2932abb5f1f2600f576a60ae6ef (patch)
treedc88db98473bd63cb1a7e9362e210ff65b67074b
parent7c9ac111c5e5d92e620b666893993d5dc562e483 (diff)
downloademacs-e5de79992a22f2932abb5f1f2600f576a60ae6ef.tar.gz
emacs-e5de79992a22f2932abb5f1f2600f576a60ae6ef.zip
Revert "Add customizable to display raw bytes as hex"
This reverts commit 7c9ac111c5e5d92e620b666893993d5dc562e483.
-rw-r--r--doc/emacs/display.texi6
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/cus-start.el1
-rw-r--r--src/xdisp.c16
-rw-r--r--test/manual/redisplay-testsuite.el27
5 files changed, 4 insertions, 50 deletions
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index c4554eb3187..a0d0792eacc 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -1763,9 +1763,3 @@ itself, in pixels; the default is 2.
1763in text that is hard to read. Call the function 1763in text that is hard to read. Call the function
1764@code{tty-suppress-bold-inverse-default-colors} with a non-@code{nil} 1764@code{tty-suppress-bold-inverse-default-colors} with a non-@code{nil}
1765argument to suppress the effect of bold-face in this case. 1765argument to suppress the effect of bold-face in this case.
1766
1767@vindex display-raw-bytes-as-hex
1768 Raw bytes are displayed in octal format by default, for example a
1769byte with a decimal value of 128 is displayed as @code{\200}. To
1770change display to the hexadecimal format of @code{\x80}, set the
1771variable @code{display-raw-bytes-as-hex} to @code{t}.
diff --git a/etc/NEWS b/etc/NEWS
index 055de8ca9e8..43e7897120f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -364,10 +364,6 @@ large integers from being displayed as characters.
364** Two new commands for finding the source code of Emacs Lisp 364** Two new commands for finding the source code of Emacs Lisp
365libraries: 'find-library-other-window' and 'find-library-other-frame'. 365libraries: 'find-library-other-window' and 'find-library-other-frame'.
366 366
367+++
368** The new variable 'display-raw-bytes-as-hex' allows to change the
369display of raw bytes from octal to hex.
370
371 367
372* Editing Changes in Emacs 26.1 368* Editing Changes in Emacs 26.1
373 369
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 744fe7f69ee..4253d40b759 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -583,7 +583,6 @@ since it could result in memory overflow and make Emacs crash."
583 (const :tag "Fit (t)" :value t) 583 (const :tag "Fit (t)" :value t)
584 (const :tag "Grow only" :value grow-only)) 584 (const :tag "Grow only" :value grow-only))
585 "25.1") 585 "25.1")
586 (display-raw-bytes-as-hex display boolean "26.1")
587 ;; xfaces.c 586 ;; xfaces.c
588 (scalable-fonts-allowed display boolean "22.1") 587 (scalable-fonts-allowed display boolean "22.1")
589 ;; xfns.c 588 ;; xfns.c
diff --git a/src/xdisp.c b/src/xdisp.c
index 53210e5be5b..eaa701e9cf1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7055,7 +7055,7 @@ get_next_display_element (struct it *it)
7055 translated too. 7055 translated too.
7056 7056
7057 Non-printable characters and raw-byte characters are also 7057 Non-printable characters and raw-byte characters are also
7058 translated to octal or hexadecimal form. */ 7058 translated to octal form. */
7059 if (((c < ' ' || c == 127) /* ASCII control chars. */ 7059 if (((c < ' ' || c == 127) /* ASCII control chars. */
7060 ? (it->area != TEXT_AREA 7060 ? (it->area != TEXT_AREA
7061 /* In mode line, treat \n, \t like other crl chars. */ 7061 /* In mode line, treat \n, \t like other crl chars. */
@@ -7162,12 +7162,9 @@ get_next_display_element (struct it *it)
7162 int len, i; 7162 int len, i;
7163 7163
7164 if (CHAR_BYTE8_P (c)) 7164 if (CHAR_BYTE8_P (c))
7165 /* Display \200 or \x80 instead of \17777600. */ 7165 /* Display \200 instead of \17777600. */
7166 c = CHAR_TO_BYTE8 (c); 7166 c = CHAR_TO_BYTE8 (c);
7167 const char *format_string = display_raw_bytes_as_hex 7167 len = sprintf (str, "%03o", c + 0u);
7168 ? "x%02x"
7169 : "%03o";
7170 len = sprintf (str, format_string, c + 0u);
7171 7168
7172 XSETINT (it->ctl_chars[0], escape_glyph); 7169 XSETINT (it->ctl_chars[0], escape_glyph);
7173 for (i = 0; i < len; i++) 7170 for (i = 0; i < len; i++)
@@ -32234,13 +32231,6 @@ display table takes effect; in this case, Emacs does not consult
32234 /* Initialize to t, since we need to disable reordering until 32231 /* Initialize to t, since we need to disable reordering until
32235 loadup.el successfully loads charprop.el. */ 32232 loadup.el successfully loads charprop.el. */
32236 redisplay__inhibit_bidi = true; 32233 redisplay__inhibit_bidi = true;
32237
32238 DEFVAR_BOOL ("display-raw-bytes-as-hex", display_raw_bytes_as_hex,
32239 doc: /* Non-nil means display raw bytes in hexadecimal format.
32240The default is to use octal format (\200) whereas hexadecimal (\x80)
32241may be more familar to users. */);
32242 display_raw_bytes_as_hex = false;
32243
32244} 32234}
32245 32235
32246 32236
diff --git a/test/manual/redisplay-testsuite.el b/test/manual/redisplay-testsuite.el
index 2175cbab1b7..694d55ab1db 100644
--- a/test/manual/redisplay-testsuite.el
+++ b/test/manual/redisplay-testsuite.el
@@ -34,8 +34,7 @@
34 (setq overlay (make-overlay opoint (point))) 34 (setq overlay (make-overlay opoint (point)))
35 (while props 35 (while props
36 (overlay-put overlay (car props) (cadr props)) 36 (overlay-put overlay (car props) (cadr props))
37 (setq props (cddr props))) 37 (setq props (cddr props)))))
38 overlay))
39 38
40(defun test-redisplay-1 () 39(defun test-redisplay-1 ()
41 (insert "Test 1: Displaying adjacent and overlapping overlays:\n\n") 40 (insert "Test 1: Displaying adjacent and overlapping overlays:\n\n")
@@ -294,29 +293,6 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff
294 293
295 (insert "\n")) 294 (insert "\n"))
296 295
297(defvar test-redisplay-5-expected-overlay nil)
298(defvar test-redisplay-5-result-overlay nil)
299
300(defun test-redisplay-5-toggle (_event)
301 (interactive "e")
302 (setq display-raw-bytes-as-hex (not display-raw-bytes-as-hex))
303 (let ((label (if display-raw-bytes-as-hex "\\x80" "\\200")))
304 (overlay-put test-redisplay-5-expected-overlay 'display
305 (propertize label 'face 'escape-glyph))))
306
307(defun test-redisplay-5 ()
308 (insert "Test 5: Display of raw bytes:\n\n")
309 (insert " Expected: ")
310 (setq test-redisplay-5-expected-overlay
311 (test-insert-overlay " " 'display
312 (propertize "\\200" 'face 'escape-glyph)))
313 (insert "\n Result: ")
314 (setq test-redisplay-5-result-overlay
315 (test-insert-overlay " " 'display "\200"))
316 (insert "\n\n")
317 (insert-button "Toggle between octal and hex display"
318 'action 'test-redisplay-5-toggle))
319
320 296
321(defun test-redisplay () 297(defun test-redisplay ()
322 (interactive) 298 (interactive)
@@ -333,6 +309,5 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff
333 (test-redisplay-2) 309 (test-redisplay-2)
334 (test-redisplay-3) 310 (test-redisplay-3)
335 (test-redisplay-4) 311 (test-redisplay-4)
336 (test-redisplay-5)
337 (goto-char (point-min)))) 312 (goto-char (point-min))))
338 313