[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#38485: "prettified" symbols
From: |
Clément Pit-Claudel |
Subject: |
bug#38485: "prettified" symbols |
Date: |
Fri, 6 Dec 2019 00:51:25 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 |
On 2019-12-05 23:15, Richard Stallman wrote:
> Would someone please send me a 10-line general explanation of
> what the "prettified" symbols feature does, or would do?>
> In what modes or contexts would this operate, by default?
Happy to oblige :)
prettified-symbols-mode is a minor mode that appeared around Emacs 24.5 or so,
a few years ago. It lets users instruct Emacs to change the way certain words
or symbols are displayed, to make the contents of the buffer more visually
appealing or easier to read. It doesn't change the actual contents of the
buffer, nor what gets saved to disk.
For example, consider the following bits of C and C++ code:
pstr->wcs[idx] != WEOF || pstr->valid_len == idx + 1
std::cout << (x >= 0);
If I set prettify-symbols-alist to the following value:
(setq-local prettify-symbols-alist
'(("->" . ?→) ("!=" . ?≠) ("==" . ?≡)
(">=" . ?≥) ("||" . ?‖) ("::" . ?∷)
("<<" . ?≪)))
then Emacs will display these snippets thus:
pstr→wcs[idx] ≠ WEOF ‖ pstr→valid_len ≡ idx + 1
std∷cout ≪ (x ≥ 0);
I don't think this feature is enabled by default in any mode that ships with
Emacs, but it is in some third-party packages. It is particularly popular for
users of math-oriented programming languages; for example, this is the value of
prettify-symbols-alist in fstar-mode:
'(("exists" . ?∃) ("forall" . ?∀) ("fun" . ?λ)
("nat" . ?ℕ) ("int" . ?ℤ)
("True" . ?⊤) ("False" . ?⊥)
("*" . ?×) (":=" . ?≔) ("::" . ?⸬)
("<=" . ?≤) (">=" . ?≥) ("<>" . ?≠)
("/\\" . ?∧) ("\\/" . ?∨) ("~" . ?¬) ("||" . ?‖)
("<==>" . ?⟺) ("==>" . ?⟹) ;; ("<==" . ?⟸)
("->" . ?→) ("~>" . ?↝) ("=>" . ?⇒)
("<-" . ?←) ("<--" . ?⟵) ("-->" . ?⟶)
("<<" . ?≪) ("<|" . ?◃) ("|>" . ?▹)
("'a" . ?α) ("'b" . ?β) ("'c" . ?γ)
("'d" . ?δ) ("'e" . ?ε) ("'f" . ?φ)
("'g" . ?χ) ("'h" . ?η) ("'i" . ?ι)
("'k" . ?κ) ("'m" . ?μ) ("'n" . ?ν)
("'p" . ?π) ("'q" . ?θ) ("'r" . ?ρ)
("'s" . ?σ) ("'t" . ?τ) ("'u" . ?ψ)
("'w" . ?ω) ("'x" . ?ξ) ("'z" . ?ζ))
You should try it :) It's packaged with Emacs, and it's a really neat feature.
Clément.
- bug#38485: Customizing glyph widths, (continued)
- bug#38485: Customizing glyph widths, Clément Pit-Claudel, 2019/12/04
- bug#38485: Customizing glyph widths, Eli Zaretskii, 2019/12/04
- bug#38485: Customizing glyph widths, Clément Pit-Claudel, 2019/12/05
- bug#38485: Customizing glyph widths, Eli Zaretskii, 2019/12/05
- bug#38485: Customizing glyph widths, Clément Pit-Claudel, 2019/12/05
- bug#38485: Customizing glyph widths, Eli Zaretskii, 2019/12/05
- bug#38485: Customizing glyph widths, Clément Pit-Claudel, 2019/12/05
- bug#38485: "prettified" symbols, Richard Stallman, 2019/12/05
- bug#38485: "prettified" symbols, Eli Zaretskii, 2019/12/06
- bug#38485: "prettified" symbols, Richard Stallman, 2019/12/06
- bug#38485: "prettified" symbols,
Clément Pit-Claudel <=
- bug#38485: Customizing glyph widths, Clément Pit-Claudel, 2019/12/04
- bug#38485: Customizing glyph widths, Eli Zaretskii, 2019/12/04
- bug#38485: Customizing glyph widths, Clément Pit-Claudel, 2019/12/05
bug#38485: Customizing glyph widths, Yuan Fu, 2019/12/04