summaryrefslogtreecommitdiff
path: root/test/manual/redisplay-testsuite.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2017-06-01 21:12:39 +0300
committerEli Zaretskii <eliz@gnu.org>2017-06-01 21:12:39 +0300
commit7c9ac111c5e5d92e620b666893993d5dc562e483 (patch)
tree1363798d47fc5a7433519129fb726651a4c12a2e /test/manual/redisplay-testsuite.el
parente922e3c7a5c895f3875e7eb4670618891a4fd312 (diff)
downloademacs-7c9ac111c5e5d92e620b666893993d5dc562e483.tar.gz
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/manual/redisplay-testsuite.el')
-rw-r--r--test/manual/redisplay-testsuite.el27
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 @@
(setq overlay (make-overlay opoint (point)))
(while props
(overlay-put overlay (car props) (cadr props))
- (setq props (cddr props)))))
+ (setq props (cddr props)))
+ overlay))
(defun test-redisplay-1 ()
(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
(insert "\n"))
+(defvar test-redisplay-5-expected-overlay nil)
+(defvar test-redisplay-5-result-overlay nil)
+
+(defun test-redisplay-5-toggle (_event)
+ (interactive "e")
+ (setq display-raw-bytes-as-hex (not display-raw-bytes-as-hex))
+ (let ((label (if display-raw-bytes-as-hex "\\x80" "\\200")))
+ (overlay-put test-redisplay-5-expected-overlay 'display
+ (propertize label 'face 'escape-glyph))))
+
+(defun test-redisplay-5 ()
+ (insert "Test 5: Display of raw bytes:\n\n")
+ (insert " Expected: ")
+ (setq test-redisplay-5-expected-overlay
+ (test-insert-overlay " " 'display
+ (propertize "\\200" 'face 'escape-glyph)))
+ (insert "\n Result: ")
+ (setq test-redisplay-5-result-overlay
+ (test-insert-overlay " " 'display "\200"))
+ (insert "\n\n")
+ (insert-button "Toggle between octal and hex display"
+ 'action 'test-redisplay-5-toggle))
+
(defun test-redisplay ()
(interactive)
@@ -309,5 +333,6 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff
(test-redisplay-2)
(test-redisplay-3)
(test-redisplay-4)
+ (test-redisplay-5)
(goto-char (point-min))))