diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-09-09 02:21:16 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-09-09 02:22:24 -0700 |
commit | 6e5d81ff4536ed117dfac269357c46dbdc1890c9 (patch) | |
tree | ce637dad553f16c3dab02720bee505c938416beb /lisp/international | |
parent | 39dca94701de81d02c75316e32d67e3677bd685d (diff) |
Improvements for curved quotes on Linux consule
This should help Emacs work better out-of-the-box on Linux consoles,
which have only limited support for displaying Unicode characters.
Also, undo the recent change that caused text-quoting-style to
affect quote display on terminals, so that the two features are
independent. See Alan Mackenzie in:
http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00244.html
Finally, add a style parameter to startup--setup-quote-display,
so that this function can also be invoked after startup, with
different styles depending on user preference at the time.
* configure.ac: Check for linux/kd.h header.
* doc/emacs/display.texi (Text Display): Document quote display.
* doc/lispref/display.texi (Active Display Table):
* etc/NEWS:
* lisp/startup.el (startup--setup-quote-display, command-line):
text-quoting-style no longer affects quote display.
* doc/lispref/frames.texi (Terminal Parameters): Fix typo.
* lisp/international/mule-util.el (char-displayable-p):
* lisp/startup.el (startup--setup-quote-display):
On a text terminal supporting glyph codes, use the reported
glyph codes instead of the terminal coding system, as this
is more accurate on the Linux console.
* lisp/startup.el (startup--setup-quote-display):
New optional arg STYLE.
* src/fontset.c (Finternal_char_font):
Report glyph codes for a text terminal, if they are available.
Currently this is supported only for the Linux console.
* src/termhooks.h (struct terminal): New member glyph-code-table.
* src/terminal.c [HAVE_LINUX_KD_H]: Include <errno.h>, <linux/kd.h>.
(calculate_glyph_code_table) [HAVE_LINUX_KD_H]: New function.
(terminal_glyph_code): New function.
Diffstat (limited to 'lisp/international')
-rw-r--r-- | lisp/international/mule-util.el | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el index f3aa70fd66..9025863646 100644 --- a/lisp/international/mule-util.el +++ b/lisp/international/mule-util.el @@ -273,43 +273,48 @@ per-character basis, this may not be accurate." ((not enable-multibyte-characters) ;; Maybe there's a font for it, but we can't put it in the buffer. nil) - ((display-multi-font-p) - ;; On a window system, a character is displayable if we have - ;; a font for that character in the default face of the - ;; currently selected frame. - (car (internal-char-font nil char))) (t - ;; On a terminal, a character is displayable if the coding - ;; system for the terminal can encode it. - (let ((coding (terminal-coding-system))) - (when coding - (let ((cs-list (coding-system-get coding :charset-list))) - (cond - ((listp cs-list) - (catch 'tag - (mapc #'(lambda (charset) - (if (encode-char char charset) - (throw 'tag charset))) - cs-list) - nil)) - ((eq cs-list 'iso-2022) - (catch 'tag2 - (mapc #'(lambda (charset) - (if (and (plist-get (charset-plist charset) - :iso-final-char) - (encode-char char charset)) - (throw 'tag2 charset))) - charset-list) - nil)) - ((eq cs-list 'emacs-mule) - (catch 'tag3 - (mapc #'(lambda (charset) - (if (and (plist-get (charset-plist charset) - :emacs-mule-id) - (encode-char char charset)) - (throw 'tag3 charset))) - charset-list) - nil))))))))) + (let ((font-glyph (internal-char-font nil char))) + (if font-glyph + (if (consp font-glyph) + ;; On a window system, a character is displayable + ;; if a font for that character is in the default + ;; face of the currently selected frame. + (car font-glyph) + ;; On a text terminal supporting glyph codes, CHAR is + ;; displayable if its glyph code is nonnegative. + (<= 0 font-glyph)) + ;; On a teext terminal without glyph codes, CHAR is displayable + ;; if the coding system for the terminal can encode it. + (let ((coding (terminal-coding-system))) + (when coding + (let ((cs-list (coding-system-get coding :charset-list))) + (cond + ((listp cs-list) + (catch 'tag + (mapc #'(lambda (charset) + (if (encode-char char charset) + (throw 'tag charset))) + cs-list) + nil)) + ((eq cs-list 'iso-2022) + (catch 'tag2 + (mapc #'(lambda (charset) + (if (and (plist-get (charset-plist charset) + :iso-final-char) + (encode-char char charset)) + (throw 'tag2 charset))) + charset-list) + nil)) + ((eq cs-list 'emacs-mule) + (catch 'tag3 + (mapc #'(lambda (charset) + (if (and (plist-get (charset-plist charset) + :emacs-mule-id) + (encode-char char charset)) + (throw 'tag3 charset))) + charset-list) + nil))))))))))) (defun filepos-to-bufferpos--dos (byte f) (let ((eol-offset 0) |