Prettify special glyphs

* lisp/disp-table.el (prettify-special-glyphs-mode): New mode to
display nicer special glyphs.
(special-glyphs): New face for displaying special glyphs when
the minor mode is active.
(prettify-special-glyphs-saved-truncation)
(prettify-special-glyphs-saved-continuation): Internal variables
to save previous special glyphs.
* etc/NEWS: Announce the change.  (Bug#80628)
This commit is contained in:
Manuel Giraud 2026-05-04 10:14:36 +02:00 committed by Eli Zaretskii
parent f13287fde0
commit 7a17f97baa
2 changed files with 50 additions and 0 deletions

View file

@ -169,6 +169,12 @@ behavior, customize 'find-function-mode-lower-precedence' to non-nil.
---
** 'find-function' can now find 'cl-defmethod' invocations inside macros.
---
** New minor mode 'prettify-special-glyphs-mode'.
The new minor mode prettifies the special character glyphs (truncation
and continuation) on TTY frames (and GUI frames without fringes). You
can customize the associated new face 'special-glyphs'.
** Minibuffer and Completions
+++

View file

@ -458,6 +458,50 @@ which characters can be displayed and which cannot."
(insert ")\n"))
(pop-to-buffer buf)))
(defface special-glyphs
'((t :inherit (shadow default)))
"Face for displaying special glyphs."
:group 'basic-faces
:version "31.1")
(defvar prettify-special-glyphs-saved-truncation)
(defvar prettify-special-glyphs-saved-continuation)
;;;###autoload
(define-minor-mode prettify-special-glyphs-mode
"Mode to display pretty special character glyphs.
If you have already customized your special character glyphs, only the
`special-glyphs' face is applied to them. This mode only applies to the
`standard-display-table'. Window or buffer display table, if defined,
still take precedence."
:global t
:group 'display
(if prettify-special-glyphs-mode
(let ((tbl standard-display-table)
truncation wrap)
;; Save current glyphs.
(setq prettify-special-glyphs-saved-truncation
(display-table-slot tbl 'truncation)
prettify-special-glyphs-saved-continuation
(display-table-slot tbl 'wrap))
;; Prepare new ones with face.
(setq truncation
(if prettify-special-glyphs-saved-truncation
(make-glyph-code prettify-special-glyphs-saved-truncation
'special-glyphs)
(make-glyph-code ?→ 'special-glyphs))
wrap
(if prettify-special-glyphs-saved-continuation
(make-glyph-code prettify-special-glyphs-saved-continuation
'special-glyphs)
(make-glyph-code ?↩ 'special-glyphs)))
;; Alter display-table.
(set-display-table-slot tbl 'truncation truncation)
(set-display-table-slot tbl 'wrap wrap))
(let ((tbl standard-display-table))
;; Reset saved glyphs.
(set-display-table-slot tbl 'truncation prettify-special-glyphs-saved-truncation)
(set-display-table-slot tbl 'wrap prettify-special-glyphs-saved-continuation))))
(provide 'disp-table)