all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: rms@gnu.org
Cc: casouri@gmail.com, 38485@debbugs.gnu.org
Subject: bug#38485: "prettified" symbols
Date: Fri, 6 Dec 2019 00:51:25 -0500	[thread overview]
Message-ID: <c83dfd37-857e-16d7-401b-b9b10fd7d835@gmail.com> (raw)
In-Reply-To: <E1id51b-0007ht-QX@fencepost.gnu.org>

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.





  reply	other threads:[~2019-12-06  5:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04  4:22 bug#38485: Customizing glyph widths Clément Pit-Claudel
2019-12-04 15:52 ` Eli Zaretskii
2019-12-04 16:57   ` Clément Pit-Claudel
2019-12-04 17:05     ` Eli Zaretskii
2019-12-04 18:14       ` Clément Pit-Claudel
2019-12-04 18:45         ` Eli Zaretskii
2019-12-04 20:53           ` Clément Pit-Claudel
2019-12-05  3:34             ` Eli Zaretskii
2019-12-05 14:26               ` Clément Pit-Claudel
2019-12-05 15:19                 ` Eli Zaretskii
2019-12-05 19:50                   ` Clément Pit-Claudel
2019-12-05 20:06                     ` Eli Zaretskii
2019-12-05 20:53                       ` Clément Pit-Claudel
2019-12-06  4:15                         ` bug#38485: "prettified" symbols Richard Stallman
2019-12-06  5:51                           ` Clément Pit-Claudel [this message]
2019-12-06  7:58                           ` Eli Zaretskii
2019-12-07  4:42                             ` Richard Stallman
2019-12-04 20:55           ` bug#38485: Customizing glyph widths Clément Pit-Claudel
2019-12-05  3:36             ` Eli Zaretskii
2019-12-05 14:29               ` Clément Pit-Claudel
2019-12-05  3:57   ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c83dfd37-857e-16d7-401b-b9b10fd7d835@gmail.com \
    --to=cpitclaudel@gmail.com \
    --cc=38485@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.