Skip to content

Commit 3afbe98

Browse files
committed
Update display-unicode-symbols-in-emacs
1 parent c058323 commit 3afbe98

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed
+19-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
# Display some symbols in Scheme buffers using special characters
1+
# Display Unicode symbols in Emacs
22

33
## Problem
44

5-
In Emacs, one can display some keywords, like `lambda` and `>=`, using
6-
special characters like `λ` and ``.
5+
In Emacs, display some Scheme keywords, like `lambda` and `>=`, using
6+
special Unicode characters like `λ` and ``.
77

88
## Solution
99

10-
```Emacs-Lisp
10+
The following works in modern versions of GNU Emacs:
11+
12+
```Emacs Lisp
1113
(defvar pretty-scheme-keywords
12-
'(("\\(->\\)" . #x2192)
13-
("\\(<=\\)" . #x2264)
14-
("\\(<==\\)" . #x21d0)
15-
("\\(>=\\)" . #x2265)
16-
("\\(==>\\)" . #x21d2))
17-
"alist from regexps to Unicode code points")
14+
(mapcar (lambda (pair)
15+
(cons (concat "\\(" (regexp-quote (car pair)) "\\)")
16+
(cdr pair)))
17+
'(("->" . #x2192)
18+
("<=" . #x2264)
19+
("<==" . #x21D0)
20+
(">=" . #x2265)
21+
("==>" . #x21D2)))
22+
"Alist from regexps to Unicode code points.")
1823
1924
(defun prettify-scheme ()
20-
(add-to-list 'prettify-symbols-alist '("lambda" . ?x3bb))
25+
(add-to-list 'prettify-symbols-alist '("lambda" . #x3BB))
2126
(font-lock-add-keywords
2227
nil
2328
(mapcar (lambda (keyword)
@@ -31,4 +36,6 @@ special characters like `λ` and `≥`.
3136
(turn-on-font-lock))
3237
3338
(add-hook 'scheme-mode-hook 'prettify-scheme)
34-
```
39+
```
40+
41+
Credit: [Arthur A. Gleckler](https://speechcode.com/)

www-index.scm

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@
4040
"format-unix-timestamp")
4141

4242
("File system"
43-
"find-matching-files-in-directory-tree"))
43+
"find-matching-files-in-directory-tree")
44+
45+
("Tool integrations"
46+
"display-unicode-symbols-in-emacs"))

0 commit comments

Comments
 (0)