]> code.delx.au - gnu-emacs/commitdiff
Follow text-quoting-style in display table init
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 2 Sep 2015 20:55:41 +0000 (13:55 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 2 Sep 2015 20:57:56 +0000 (13:57 -0700)
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.

doc/lispref/display.texi
doc/lispref/help.texi
etc/NEWS
lisp/startup.el

index 9d82edc9a98663afbace24eeede2e91cf0d801f9..14e2cd363a4eff1e2fbe6639327bf3017a7e4dd9 100644 (file)
@@ -6531,8 +6531,12 @@ no buffer display table.
 The value of this variable is the standard display table, which is
 used when Emacs is displaying a buffer in a window with neither a
 window display table nor a buffer display table defined, or when Emacs
-is outputting text to the standard output or error streams.  Its
-default is @code{nil}.
+is outputting text to the standard output or error streams.  Although its
+default is typically @code{nil}, in an interactive session if the
+locale cannot display curved quotes, or if the initial value of
+@code{text-quoting-style} specifies a preference for ASCII, its
+default maps curved quotes to ASCII approximations.  @xref{Keys in
+Documentation}.
 @end defvar
 
 The @file{disp-table} library defines several functions for changing
index 44c09a2085a21a38970dc9321d46f0cbb2e5780e..89339ffe575b4f92600407872e9c49f406d8166d 100644 (file)
@@ -345,7 +345,9 @@ quotes.  If the variable's value is @code{curve}, the style is
 apostrophes.  If the value is @code{grave}, the style is @t{`like
 this'} with grave accent and apostrophe.  The default value @code{nil}
 acts like @code{curve} if curved single quotes are displayable, and
-like @code{grave} otherwise.
+like @code{grave} otherwise.  To use the traditional @code{grave}
+style, put the line @code{(setq text-quoting-style 'grave)} into your
+@file{~/.emacs} file.
 @end defvar
 
 @defun substitute-command-keys string
index c664e026d4730639852052d570aaafdb1354244c..c2828c9db517a1270da543733b7f101a2582dfd2 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1113,8 +1113,9 @@ integers.
 ** New function `set-binary-mode' allows to switch a standard stream
 of the Emacs process to binary I/O mode.
 
-** In locales that cannot display curved quotes, ASCII approximations
-are installed in standard-display-table.
+** ASCII approximations to curved quotes are put in standard-display-table
+if the locale cannot display curved quotes, or if text-quoting-style
+initially specifies a preference for ASCII.
 
 ** Standard output and error streams now transliterate characters via
 standard-display-table, and encode output using locale-coding-system.
index b5e258f56c027d735d99f49dc6b9b19e3c0f0ba6..c152e0122ae595c4ebda2d2faa80a39caf8b7641 100644 (file)
@@ -804,13 +804,18 @@ to prepare for opening the first frame (e.g. open a connection to an X server)."
 (defvar server-process)
 
 (defun startup--setup-quote-display ()
-  "If curved quotes don't work, display ASCII approximations."
-  (dolist (char-repl '((?‘ . ?\`) (?’ . ?\') (?“ . ?\") (?” . ?\")))
-    (when (not (char-displayable-p (car char-repl)))
-      (unless standard-display-table
-        (setq standard-display-table (make-display-table)))
-      (aset standard-display-table (car char-repl)
-            (vector (make-glyph-code (cdr char-repl) 'shadow))))))
+  "Display ASCII approximations on user request or if curved quotes don't work."
+  (when (memq text-quoting-style '(nil grave straight))
+    (dolist (char-repl '((?‘ . ?\`) (?’ . ?\') (?“ . ?\") (?” . ?\")))
+      (let ((char (car char-repl))
+            (repl (cdr char-repl)))
+        (when (or text-quoting-style (not (char-displayable-p char)))
+          (when (and (eq repl ?\`) (eq text-quoting-style 'straight))
+            (setq repl ?\'))
+          (unless standard-display-table
+            (setq standard-display-table (make-display-table)))
+          (aset standard-display-table char
+                (vector (make-glyph-code repl 'shadow))))))))
 
 (defun command-line ()
   "A subroutine of `normal-top-level'.
@@ -1234,6 +1239,11 @@ the ‘--debug-init’ option to view a complete error backtrace."
        ;; unibyte (display table, terminal coding system &c).
        (set-language-environment current-language-environment)))
 
+    ;; Setup quote display again, if the init file sets
+    ;; text-quoting-style to a non-nil value.
+    (when (and (not noninteractive) text-quoting-style)
+      (startup--setup-quote-display))
+
     ;; Do this here in case the init file sets mail-host-address.
     (if (equal user-mail-address "")
        (setq user-mail-address (or (getenv "EMAIL")