diff options
| author | Eli Zaretskii | 2019-10-19 12:12:31 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-10-19 12:12:31 +0300 |
| commit | 8dd18bbb6f3c09a4988cf2e06378aa24b098fb85 (patch) | |
| tree | 9bd09fc23420ec5fe29aba6f7de1f6a0def099de | |
| parent | a3726f057b6467d9c4ff0e09d4b86d89bdd380a4 (diff) | |
| download | emacs-8dd18bbb6f3c09a4988cf2e06378aa24b098fb85.tar.gz emacs-8dd18bbb6f3c09a4988cf2e06378aa24b098fb85.zip | |
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.
| -rw-r--r-- | lisp/info.el | 41 |
1 files changed, 41 insertions, 0 deletions
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'." | |||
| 4297 | (defvar Info-mode-font-lock-keywords | 4297 | (defvar Info-mode-font-lock-keywords |
| 4298 | '(("‘\\([‘’]\\|[^‘’]*\\)’" (1 'Info-quoted)))) | 4298 | '(("‘\\([‘’]\\|[^‘’]*\\)’" (1 'Info-quoted)))) |
| 4299 | 4299 | ||
| 4300 | ;; See info-utils.c:degrade_utf8 in Texinfo for the source of the list | ||
| 4301 | ;; below. | ||
| 4302 | (defvar info-symbols-and-replacements | ||
| 4303 | '((?\‘ . "`") | ||
| 4304 | (?\’ . "'") | ||
| 4305 | (?\“ . "\"") | ||
| 4306 | (?\” . "\"") | ||
| 4307 | (?© . "(C)") | ||
| 4308 | (?\》 . ">>") | ||
| 4309 | (?→ . "->") | ||
| 4310 | (?⇒ . "=>") | ||
| 4311 | (?⊣ . "-|") | ||
| 4312 | (?★ . "-!-") | ||
| 4313 | (?↦ . "==>") | ||
| 4314 | (?‐ . "-") | ||
| 4315 | (?‑ . "-") | ||
| 4316 | (?‒ . "-") | ||
| 4317 | (?– . "-") | ||
| 4318 | (?— . "--") | ||
| 4319 | (?− . "-") | ||
| 4320 | (?… . "...") | ||
| 4321 | (?• . "*") | ||
| 4322 | ) | ||
| 4323 | "A list of Unicode symbols used in Info files and their ASCII translations. | ||
| 4324 | Each element should be a cons cell with its car a character and its cdr | ||
| 4325 | a string of ASCII characters.") | ||
| 4326 | |||
| 4300 | ;; Autoload cookie needed by desktop.el | 4327 | ;; Autoload cookie needed by desktop.el |
| 4301 | ;;;###autoload | 4328 | ;;;###autoload |
| 4302 | (define-derived-mode Info-mode nil "Info" ;FIXME: Derive from special-mode? | 4329 | (define-derived-mode Info-mode nil "Info" ;FIXME: Derive from special-mode? |
| @@ -4368,6 +4395,20 @@ Advanced commands: | |||
| 4368 | (setq case-fold-search t) | 4395 | (setq case-fold-search t) |
| 4369 | (setq buffer-read-only t) | 4396 | (setq buffer-read-only t) |
| 4370 | (setq Info-tag-table-marker (make-marker)) | 4397 | (setq Info-tag-table-marker (make-marker)) |
| 4398 | (unless (or (display-multi-font-p) | ||
| 4399 | (coding-system-equal | ||
| 4400 | (coding-system-base (terminal-coding-system)) | ||
| 4401 | 'utf-8)) | ||
| 4402 | (dolist (elt info-symbols-and-replacements) | ||
| 4403 | (let ((ch (car elt)) | ||
| 4404 | (repl (cdr elt))) | ||
| 4405 | (or (char-displayable-p ch) | ||
| 4406 | (aset (or buffer-display-table | ||
| 4407 | (setq buffer-display-table (make-display-table))) | ||
| 4408 | ch (vconcat (mapcar (lambda (c) | ||
| 4409 | (make-glyph-code c 'homoglyph)) | ||
| 4410 | repl))))))) | ||
| 4411 | |||
| 4371 | (if Info-use-header-line ; do not override global header lines | 4412 | (if Info-use-header-line ; do not override global header lines |
| 4372 | (setq header-line-format | 4413 | (setq header-line-format |
| 4373 | '(:eval (get-text-property (point-min) 'header-line)))) | 4414 | '(:eval (get-text-property (point-min) 'header-line)))) |