diff options
| author | Vasilij Schneidermann | 2017-06-01 21:25:58 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-06-01 21:25:58 +0300 |
| commit | cb9aa3515ac00826fd27ade7dfc829134ed38acc (patch) | |
| tree | 1363798d47fc5a7433519129fb726651a4c12a2e /test | |
| parent | e5de79992a22f2932abb5f1f2600f576a60ae6ef (diff) | |
| download | emacs-cb9aa3515ac00826fd27ade7dfc829134ed38acc.tar.gz emacs-cb9aa3515ac00826fd27ade7dfc829134ed38acc.zip | |
Add customizable to display raw bytes as hex
* src/xdisp.c (get_next_display_element): Dispatch used format string
for unprintables based on new display-raw-bytes-as-hex variable.
(display-raw-bytes-as-hex): New variable. (Bug#27122)
* lisp/cus-start.el: Add defcustom form for display-raw-bytes-as-hex.
* doc/emacs/display.texi: Document the new variable.
* etc/NEWS: Mention display-raw-bytes-as-hex.
* test/manual/redisplay-testsuite.el (test-redisplay-5-toggle)
(test-redisplay-5): New tests.
(test-redisplay): Call test-redisplay-5.
Diffstat (limited to 'test')
| -rw-r--r-- | test/manual/redisplay-testsuite.el | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test/manual/redisplay-testsuite.el b/test/manual/redisplay-testsuite.el index 694d55ab1db..2175cbab1b7 100644 --- a/test/manual/redisplay-testsuite.el +++ b/test/manual/redisplay-testsuite.el | |||
| @@ -34,7 +34,8 @@ | |||
| 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)) | ||
| 38 | 39 | ||
| 39 | (defun test-redisplay-1 () | 40 | (defun test-redisplay-1 () |
| 40 | (insert "Test 1: Displaying adjacent and overlapping overlays:\n\n") | 41 | (insert "Test 1: Displaying adjacent and overlapping overlays:\n\n") |
| @@ -293,6 +294,29 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff | |||
| 293 | 294 | ||
| 294 | (insert "\n")) | 295 | (insert "\n")) |
| 295 | 296 | ||
| 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 | |||
| 296 | 320 | ||
| 297 | (defun test-redisplay () | 321 | (defun test-redisplay () |
| 298 | (interactive) | 322 | (interactive) |
| @@ -309,5 +333,6 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff | |||
| 309 | (test-redisplay-2) | 333 | (test-redisplay-2) |
| 310 | (test-redisplay-3) | 334 | (test-redisplay-3) |
| 311 | (test-redisplay-4) | 335 | (test-redisplay-4) |
| 336 | (test-redisplay-5) | ||
| 312 | (goto-char (point-min)))) | 337 | (goto-char (point-min)))) |
| 313 | 338 | ||