From: Eli Zaretskii Date: Sat, 19 Oct 2019 09:12:31 +0000 (+0300) Subject: Fix display of Info files on TTY frames X-Git-Tag: emacs-27.0.90~988 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8dd18bbb6f3c09a4988cf2e06378aa24b098fb85;p=emacs.git Fix display of Info files on TTY frames * lisp/info.el (info-symbols-and-replacements): New variable. (Info-mode): Use 'info-symbols-and-replacements' to set up a buffer-display-table for non-ASCII symbols used by Info files that cannot be displayed on TTY frames. --- diff --git a/lisp/info.el b/lisp/info.el index fc0d58068a7..951bdad4c2b 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4297,6 +4297,33 @@ With a zero prefix arg, put the name inside a function call to `info'." (defvar Info-mode-font-lock-keywords '(("‘\\([‘’]\\|[^‘’]*\\)’" (1 'Info-quoted)))) +;; See info-utils.c:degrade_utf8 in Texinfo for the source of the list +;; below. +(defvar info-symbols-and-replacements + '((?\‘ . "`") + (?\’ . "'") + (?\“ . "\"") + (?\” . "\"") + (?© . "(C)") + (?\》 . ">>") + (?→ . "->") + (?⇒ . "=>") + (?⊣ . "-|") + (?★ . "-!-") + (?↦ . "==>") + (?‐ . "-") + (?‑ . "-") + (?‒ . "-") + (?– . "-") + (?— . "--") + (?− . "-") + (?… . "...") + (?• . "*") + ) + "A list of Unicode symbols used in Info files and their ASCII translations. +Each element should be a cons cell with its car a character and its cdr +a string of ASCII characters.") + ;; Autoload cookie needed by desktop.el ;;;###autoload (define-derived-mode Info-mode nil "Info" ;FIXME: Derive from special-mode? @@ -4368,6 +4395,20 @@ Advanced commands: (setq case-fold-search t) (setq buffer-read-only t) (setq Info-tag-table-marker (make-marker)) + (unless (or (display-multi-font-p) + (coding-system-equal + (coding-system-base (terminal-coding-system)) + 'utf-8)) + (dolist (elt info-symbols-and-replacements) + (let ((ch (car elt)) + (repl (cdr elt))) + (or (char-displayable-p ch) + (aset (or buffer-display-table + (setq buffer-display-table (make-display-table))) + ch (vconcat (mapcar (lambda (c) + (make-glyph-code c 'homoglyph)) + repl))))))) + (if Info-use-header-line ; do not override global header lines (setq header-line-format '(:eval (get-text-property (point-min) 'header-line))))