emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8dd18bb: Fix display of Info files on TTY frames


From: Eli Zaretskii
Subject: [Emacs-diffs] master 8dd18bb: Fix display of Info files on TTY frames
Date: Sat, 19 Oct 2019 05:13:35 -0400 (EDT)

branch: master
commit 8dd18bbb6f3c09a4988cf2e06378aa24b098fb85
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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.
---
 lisp/info.el | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/lisp/info.el b/lisp/info.el
index fc0d580..951bdad 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))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]