1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| (defun my/ascii-table ()
"Display basic ASCII table (0 thru 128).
https://ss64.com/ascii.html
https://www.emacswiki.org/emacs/ascii-table.el"
(interactive)
(switch-to-buffer "*ASCII*")
(erase-buffer)
(setq buffer-read-only nil) ;; Not need to edit the content, just read mode (added)
(local-set-key "q" 'bury-buffer) ;; Nice to have the option to bury the buffer (added)
(setq lower32 '("nul" "soh" "stx" "etx" "eot" "enq" "ack" "bel"
"bs" "ht" "nl" "vt" "np" "cr" "so" "si"
"dle" "dc1" "dc2" "dc3" "dc4" "nak" "syn" "etb"
"can" "em" "sub" "esc" "fs" "gs" "rs" "us"
))
(save-excursion (let ((i -1))
(insert "ASCII characters 0 thru 127.\n\n")
(insert " Hex Dec Char| Hex Dec Char| Hex Dec Char| Hex Dec Char\n")
(while (< i 31)
(insert (format "%4x %4d %4s | %4x %4d %4s | %4x %4d %4s | %4x %4d %4s\n"
(setq i (+ 1 i)) i (elt lower32 i)
(setq i (+ 32 i)) i (single-key-description i)
(setq i (+ 32 i)) i (single-key-description i)
(setq i (+ 32 i)) i (single-key-description i)))
(setq i (- i 96))))))
|