]> git.eshelyaron.com Git - emacs.git/commitdiff
Make text-quoting-style customizable. Introduce t and new meaning for nil.
authorAlan Mackenzie <acm@muc.de>
Thu, 21 Sep 2017 20:31:06 +0000 (20:31 +0000)
committerAlan Mackenzie <acm@muc.de>
Thu, 21 Sep 2017 20:31:06 +0000 (20:31 +0000)
A value of nil for text-quoting-style now means "no translation".  t means
"Use curved quotes if displayable".

* src/doc.c (text-quoting-style (function)): modify for new semantics.
(text-quoting-style (variable)): Amend the doc string, set the default value
to t.

* lisp/cus-start.el: (top level): Create a customize entry for
text-quoting-style in group display.

* etc/NEWS: Amend the entry for text-quoting-style.

* doc/emacs/display.texi (Text Display): Describe the translation of ASCII
quotes to curved quotes, and how to influence or inhibit it.

* doc/lispref/control.texi (Signalling Errors)
* doc/lispref/display.texi (Displaying Messages)
* doc/lispref/strings.texi (Formatting Strings): Describe binding
text-quoting-style to nil to inhibit unwanted quote translation.

* doc/lispref/help.texi (Keys in Documentation): Change text-quoting-style
from a variable to a user option.  Describe its changed set of values.  State
that it can be customized freely.

doc/emacs/display.texi
doc/lispref/control.texi
doc/lispref/display.texi
doc/lispref/help.texi
doc/lispref/strings.texi
etc/NEWS
lisp/cus-start.el
src/doc.c

index 2aa79e1161a0beb33e9ccf66288e9d9dbdca8804..b96f3bc9a8bdeb130a758d29d6c7a4a6f9c584fc 100644 (file)
@@ -1548,11 +1548,20 @@ for details.
 @cindex curly quotes
 @cindex curved quotes
 @cindex homoglyph face
+
+Emacs tries to determine if the curved quotes @samp{‘} and @samp{’}
+can be displayed on the current display.  By default, if this seems to
+be so, then Emacs will translate the @acronym{ASCII} quotes (@samp{`}
+and @samp{'}), when they appear in messages and help texts, to these
+curved quotes.  You can influence or inhibit this translation by
+customizing the user option @code{text-quoting-style} (@pxref{Keys in
+Documentation,,, elisp, The Emacs Lisp Reference Manual}).
+
   If the curved quotes @samp{‘}, @samp{’}, @samp{“}, and @samp{”} are
 known to look just like @acronym{ASCII} characters, they are shown
-with the @code{homoglyph} face.  Curved quotes that cannot be
-displayed are shown as their @acronym{ASCII} approximations @samp{`},
-@samp{'}, and @samp{"} with the @code{homoglyph} face.
+with the @code{homoglyph} face.  Curved quotes that are known not to
+be displayable are shown as their @acronym{ASCII} approximations
+@samp{`}, @samp{'}, and @samp{"} with the @code{homoglyph} face.
 
 @node Cursor Display
 @section Displaying the Cursor
index 401a999cf23c5f221f1babf8cc1f37f9164de34c..09435f579665e04c5a259a61b3c52df53b55a4ea 100644 (file)
@@ -1108,6 +1108,9 @@ generates a message like @t{"Missing ‘foo’"} with matching curved
 quotes.  In contrast, a call using a format like @t{"Missing '%s'"}
 with only apostrophes typically generates a message like @t{"Missing
 ’foo’"} with only closing curved quotes, an unusual style in English.
+One way around this problem is to bind @code{text-quoting-style} to
+@code{nil} around the call to @code{error}; this causes the
+@acronym{ASCII} quote characters to be output unchanged.
 
 @strong{Warning:} If you want to use your own string as an error message
 verbatim, don't just write @code{(error @var{string})}.  If @var{string}
index 3dae984f339d1633d0f8e734e811ae9f3d9406c0..8f58fca506f915f88c9414162c1c5641df6abcf7 100644 (file)
@@ -272,6 +272,9 @@ generates a message like @t{"Missing ‘foo’"} with matching curved
 quotes.  In contrast, a call using a format like @t{"Missing '%s'"}
 with only apostrophes typically generates a message like @t{"Missing
 ’foo’"} with only closing curved quotes, an unusual style in English.
+One way around this problem is to bind @code{text-quoting-style} to
+@code{nil} around calls to @code{message}; this causes the
+@acronym{ASCII} quote characters to be output unchanged.
 
 In batch mode, the message is printed to the standard error stream,
 followed by a newline.
index cb214113523c5e9d7408c01800f7ce44b8c8c415..e1e98124e08480aedd850e401b3a1c1778e32880 100644 (file)
@@ -351,25 +351,24 @@ and @samp{\=\=} puts @samp{\=} into the output.
 @strong{Please note:} Each @samp{\} must be doubled when written in a
 string in Emacs Lisp.
 
-@defvar text-quoting-style
+@defopt text-quoting-style
 @cindex curved quotes
 @cindex curly quotes
 The value of this variable is a symbol that specifies the style Emacs
-should use for single quotes in the wording of help and messages.
-If the variable's value is @code{curve}, the style is
-@t{‘like this’} with curved single quotes.  If the value is
-@code{straight}, the style is @t{'like this'} with straight
-apostrophes.  If the value is @code{grave},
-quotes are not translated and the style is @t{`like
-this'} with grave accent and apostrophe, the standard style
-before Emacs version 25.  The default value @code{nil}
-acts like @code{curve} if curved single quotes are displayable, and
-like @code{grave} otherwise.
-
-This variable can be used by experts on platforms that have problems
-with curved quotes.  As it is not intended for casual use, it is not a
-user option.
-@end defvar
+should use for single quotes in the wording of help and messages.  If
+the variable's value is @code{curve}, the style is @t{‘like this’}
+with curved single quotes.  If the value is @code{straight}, the style
+is @t{'like this'} with straight apostrophes.  If the value is
+@code{nil} or @code{grave}, quotes are not translated and the style is
+@t{`like this'} with grave accent and apostrophe, the standard style
+before Emacs version 25.  The default value @code{t} acts like
+@code{curve} if curved single quotes seem to be displayable, and like
+@code{nil} otherwise.
+
+This option is useful on platforms that have problems with curved
+quotes.  You can customize it freely according to your personal
+preference.
+@end defopt
 
 @defun substitute-command-keys string
 This function scans @var{string} for the above special sequences and
index 219225d412b20e603707a8ab5376d335d70012f3..117a373a190d443dd9cb797ed0e36a151e21b8e0 100644 (file)
@@ -835,8 +835,11 @@ A format that quotes with grave accents and apostrophes @t{`like
 this'} typically generates curved quotes @t{‘like this’}.  In
 contrast, a format that quotes with only apostrophes @t{'like this'}
 typically generates two closing curved quotes @t{’like this’}, an
-unusual style in English.  @xref{Keys in Documentation}, for how the
-@code{text-quoting-style} variable affects generated quotes.
+unusual style in English.  One way around such problems is to bind
+@code{text-quoting-style} to @code{nil} around calls to
+@code{format-message}; this causes the @acronym{ASCII} quoting
+characters to be output unchanged.  @xref{Keys in Documentation}, for
+how the @code{text-quoting-style} variable affects generated quotes.
 @end defun
 
 @cindex @samp{%} in format
index 280ab64f37c534c494eb77c7bb268124782f8ef9..f19872e9717f85bef30a5dc39b94fcd1b4333a60 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1231,10 +1231,15 @@ change FOO, respectively.  The exhaustive list of removed variables is:
 *** Many variables obsoleted in 22.1 referring to face symbols
 
 +++
-** The variable 'text-quoting-style' no longer affects the treatment
-of curved quotes in format arguments to functions like 'message' and
-'format-message'.  In particular, when this variable's value is
-'grave', all quotes in formats are output as-is.
+** The variable `text-quoting-style' is now a customizable option.  It
+controls whether to and how to translate ASCII quotes in messages and
+help output.  The value nil now means "no translation", and the value
+t, the default, means "use curved quotes if displayable" (as nil did
+in Emacs 25).  The other possible values remain unchanged.
+`text-quoting-style' no longer affects the treatment of curved quotes
+in format arguments to functions like `message' and `format-message'.
+In particular, when this variable's value is `grave', all quotes in
+formats are output as-is.
 
 ---
 ** Functions like 'check-declare-file' and 'check-declare-directory'
index b197f2f1de597fdfb1c9593167f32b0b61eda70a..effd7bd5d6d040b7f28c7f4535f5f1e53551e520 100644 (file)
@@ -223,6 +223,15 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
             (visible-bell display boolean)
             (no-redraw-on-reenter display boolean)
 
+             ;; doc.c
+             (text-quoting-style display
+                                 (choice
+                                  (const :tag "No translation" nil)
+                                  (const :tag "Prefer \\=‘curved\\=’ quotes, if possible" t)
+                                  (const :tag "\\=‘Curved\\=’ quotes" curved)
+                                  (const :tag "\\='Straight\\=' quotes" straight)
+                                  (const :tag "\\=`Grave\\=' quotes" grave)))
+
              ;; dosfns.c
             (dos-display-scancodes display boolean)
             (dos-hyper-key keyboard integer)
index 3286c12675a2f43fcec3e64a80bfb118c4e7406a..e2af39ef07f057dcff2b0a24a5f0d3baa0563e1d 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -690,8 +690,9 @@ enum text_quoting_style
 text_quoting_style (void)
 {
   if (NILP (Vtext_quoting_style)
-      ? default_to_grave_quoting_style ()
-      : EQ (Vtext_quoting_style, Qgrave))
+      || (EQ (Vtext_quoting_style, Qt)
+          ? default_to_grave_quoting_style ()
+          : EQ (Vtext_quoting_style, Qgrave)))
     return GRAVE_QUOTING_STYLE;
   else if (EQ (Vtext_quoting_style, Qstraight))
     return STRAIGHT_QUOTING_STYLE;
@@ -1018,22 +1019,25 @@ syms_of_doc (void)
   Vbuild_files = Qnil;
 
   DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style,
-               doc: /* Style to use for single quotes in help and messages.
-Its value should be a symbol.  It works by substituting certain single
-quotes for grave accent and apostrophe.  This is done in help output
-and in functions like `message' and `format-message'.  It is not done
-in `format'.
-
-`curve' means quote with curved single quotes ‘like this’.
-`straight' means quote with straight apostrophes \\='like this\\='.
-`grave' means quote with grave accent and apostrophe \\=`like this\\=';
-i.e., do not alter quote marks.  The default value nil acts like
-`curve' if curved single quotes are displayable, and like `grave'
-otherwise.  */);
-  Vtext_quoting_style = Qnil;
+               doc: /* How to translate single quotes in help and messages.
+Its value should be a symbol, and describes the style of quote
+substituted for ASCII quote characters GRAVE ACCENT (\\=`, \\=\\x60) and
+APOSTROPHE (\\=', \\=\\x27).  This is done in help output and in functions
+like `message' and `format-message'.  It is not done in `format'.
+
+The value nil means do not translate the quotes at all.  The value t
+(the default) acts like `curve' if curved single quotes appear to be
+displayable, and like nil otherwise.  `curve' means quote with curved
+single quotes ‘like this’.  `straight' means quote with apostrophes
+\\='like this\\='.  `grave' means do not translate quote marks and is
+now a synonym for nil.
+
+(The value t was newly introduced in Emacs 26, and in Emacs 25 nil
+meant what t means now.)  */);
+  Vtext_quoting_style = Qt;
 
   DEFVAR_BOOL ("internal--text-quoting-flag", text_quoting_flag,
-              doc: /* If nil, a nil `text-quoting-style' is treated as `grave'.  */);
+              doc: /* If nil, a `text-quoting-style' value t is treated as `nil'.  */);
   /* Initialized by ‘main’.  */
 
   defsubr (&Sdocumentation);