ocatl-to-hex: site-lisp defun

* convert ocatl escape sequences to hexglyphs

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2020-06-24 01:38:51 +02:00
parent eccf4d5b64
commit b2fc283fdd

13
site-lisp/octal-to-hex.el Normal file
View File

@@ -0,0 +1,13 @@
(defun use-hex-not-octal ()
"Use hexadecimal escape sequences instead of octal."
(interactive)
(require 'cl-lib)
(unless buffer-display-table
(setq buffer-display-table (make-display-table)))
(setq unprintable (append (number-sequence 127 255) (number-sequence 0 8) (number-sequence 11 31)))
(cl-loop
for x in unprintable
do (aset buffer-display-table (unibyte-char-to-multibyte x)
(cl-map 'vector
(lambda (c) (make-glyph-code c 'escape-glyph))
(format "\\%02x" x)))))