aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2015-09-02 13:55:41 -0700
committerPaul Eggert2015-09-02 13:57:56 -0700
commita9706c6cc16baeaf49b1dfc4badc0254870c449d (patch)
tree3b37655e0942c7d1e607a61dd14859456f3df6ae
parentfa5a9c7bae6d484107162641d16b1b38312ac225 (diff)
downloademacs-a9706c6cc16baeaf49b1dfc4badc0254870c449d.tar.gz
emacs-a9706c6cc16baeaf49b1dfc4badc0254870c449d.zip
Follow text-quoting-style in display table init
This attempts to fix a problem reported by Alan Mackenzie in: http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00112.html * doc/lispref/display.texi (Active Display Table): Mention how text-quoting-style affects it. * doc/lispref/help.texi (Keys in Documentation): Say how to set text-quoting-style in ~/.emacs. * etc/NEWS: Document the change. * lisp/startup.el (startup--setup-quote-display): Follow user preference if text-quoting-style is set. (command-line): Setup quote display again if user expresses a preference in .emacs.
-rw-r--r--doc/lispref/display.texi8
-rw-r--r--doc/lispref/help.texi4
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/startup.el24
4 files changed, 29 insertions, 12 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 9d82edc9a98..14e2cd363a4 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -6531,8 +6531,12 @@ no buffer display table.
6531The value of this variable is the standard display table, which is 6531The value of this variable is the standard display table, which is
6532used when Emacs is displaying a buffer in a window with neither a 6532used when Emacs is displaying a buffer in a window with neither a
6533window display table nor a buffer display table defined, or when Emacs 6533window display table nor a buffer display table defined, or when Emacs
6534is outputting text to the standard output or error streams. Its 6534is outputting text to the standard output or error streams. Although its
6535default is @code{nil}. 6535default is typically @code{nil}, in an interactive session if the
6536locale cannot display curved quotes, or if the initial value of
6537@code{text-quoting-style} specifies a preference for ASCII, its
6538default maps curved quotes to ASCII approximations. @xref{Keys in
6539Documentation}.
6536@end defvar 6540@end defvar
6537 6541
6538The @file{disp-table} library defines several functions for changing 6542The @file{disp-table} library defines several functions for changing
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index 44c09a2085a..89339ffe575 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -345,7 +345,9 @@ quotes. If the variable's value is @code{curve}, the style is
345apostrophes. If the value is @code{grave}, the style is @t{`like 345apostrophes. If the value is @code{grave}, the style is @t{`like
346this'} with grave accent and apostrophe. The default value @code{nil} 346this'} with grave accent and apostrophe. The default value @code{nil}
347acts like @code{curve} if curved single quotes are displayable, and 347acts like @code{curve} if curved single quotes are displayable, and
348like @code{grave} otherwise. 348like @code{grave} otherwise. To use the traditional @code{grave}
349style, put the line @code{(setq text-quoting-style 'grave)} into your
350@file{~/.emacs} file.
349@end defvar 351@end defvar
350 352
351@defun substitute-command-keys string 353@defun substitute-command-keys string
diff --git a/etc/NEWS b/etc/NEWS
index c664e026d47..c2828c9db51 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1113,8 +1113,9 @@ integers.
1113** New function `set-binary-mode' allows to switch a standard stream 1113** New function `set-binary-mode' allows to switch a standard stream
1114of the Emacs process to binary I/O mode. 1114of the Emacs process to binary I/O mode.
1115 1115
1116** In locales that cannot display curved quotes, ASCII approximations 1116** ASCII approximations to curved quotes are put in standard-display-table
1117are installed in standard-display-table. 1117if the locale cannot display curved quotes, or if text-quoting-style
1118initially specifies a preference for ASCII.
1118 1119
1119** Standard output and error streams now transliterate characters via 1120** Standard output and error streams now transliterate characters via
1120standard-display-table, and encode output using locale-coding-system. 1121standard-display-table, and encode output using locale-coding-system.
diff --git a/lisp/startup.el b/lisp/startup.el
index b5e258f56c0..c152e0122ae 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -804,13 +804,18 @@ to prepare for opening the first frame (e.g. open a connection to an X server)."
804(defvar server-process) 804(defvar server-process)
805 805
806(defun startup--setup-quote-display () 806(defun startup--setup-quote-display ()
807 "If curved quotes don't work, display ASCII approximations." 807 "Display ASCII approximations on user request or if curved quotes don't work."
808 (dolist (char-repl '((?‘ . ?\`) (?’ . ?\') (?“ . ?\") (?” . ?\"))) 808 (when (memq text-quoting-style '(nil grave straight))
809 (when (not (char-displayable-p (car char-repl))) 809 (dolist (char-repl '((?‘ . ?\`) (?’ . ?\') (?“ . ?\") (?” . ?\")))
810 (unless standard-display-table 810 (let ((char (car char-repl))
811 (setq standard-display-table (make-display-table))) 811 (repl (cdr char-repl)))
812 (aset standard-display-table (car char-repl) 812 (when (or text-quoting-style (not (char-displayable-p char)))
813 (vector (make-glyph-code (cdr char-repl) 'shadow)))))) 813 (when (and (eq repl ?\`) (eq text-quoting-style 'straight))
814 (setq repl ?\'))
815 (unless standard-display-table
816 (setq standard-display-table (make-display-table)))
817 (aset standard-display-table char
818 (vector (make-glyph-code repl 'shadow))))))))
814 819
815(defun command-line () 820(defun command-line ()
816 "A subroutine of `normal-top-level'. 821 "A subroutine of `normal-top-level'.
@@ -1234,6 +1239,11 @@ the ‘--debug-init’ option to view a complete error backtrace."
1234 ;; unibyte (display table, terminal coding system &c). 1239 ;; unibyte (display table, terminal coding system &c).
1235 (set-language-environment current-language-environment))) 1240 (set-language-environment current-language-environment)))
1236 1241
1242 ;; Setup quote display again, if the init file sets
1243 ;; text-quoting-style to a non-nil value.
1244 (when (and (not noninteractive) text-quoting-style)
1245 (startup--setup-quote-display))
1246
1237 ;; Do this here in case the init file sets mail-host-address. 1247 ;; Do this here in case the init file sets mail-host-address.
1238 (if (equal user-mail-address "") 1248 (if (equal user-mail-address "")
1239 (setq user-mail-address (or (getenv "EMAIL") 1249 (setq user-mail-address (or (getenv "EMAIL")