aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2015-08-02 15:58:02 -0700
committerPaul Eggert2015-08-02 15:58:31 -0700
commitfa10e77790a207aeabf354c9f5667b3dbde55bb2 (patch)
tree9ab7b0e8bbd340d76f34583aeaa7721c7f59008f
parentfc9206b73a254a400245578b94542cfe82c68e9c (diff)
downloademacs-fa10e77790a207aeabf354c9f5667b3dbde55bb2.tar.gz
emacs-fa10e77790a207aeabf354c9f5667b3dbde55bb2.zip
Redo text-quoting-style variable
Rename help-quote-translation to text-quoting-style, and use symbols rather than characters as values. This follows suggestions along these lines by Alan Mackenzie in: http://lists.gnu.org/archive/html/emacs-devel/2015-06/msg00343.html and by Drew Adams in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00048.html * doc/lispref/help.texi (Keys in Documentation) * etc/NEWS: * lisp/cus-start.el (standard): * src/doc.c (Fsubstitute_command_keys, syms_of_doc): Document and/or implement the new behavior instead of the old. (syms_of_doc): New symbols 'grave' and 'straight'.
-rw-r--r--doc/lispref/help.texi16
-rw-r--r--etc/NEWS20
-rw-r--r--lisp/cus-start.el18
-rw-r--r--src/doc.c27
4 files changed, 42 insertions, 39 deletions
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index 779a0d581e2..ca8ae3f314a 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -347,18 +347,18 @@ and @samp{\=\=} puts @samp{\=} into the output.
347@strong{Please note:} Each @samp{\} must be doubled when written in a 347@strong{Please note:} Each @samp{\} must be doubled when written in a
348string in Emacs Lisp. 348string in Emacs Lisp.
349 349
350@defvar help-quote-translation 350@defvar text-quoting-style
351@cindex curved quotes 351@cindex curved quotes
352@cindex curly quotes 352@cindex curly quotes
353The value of this variable specifies the style 353The value of this variable specifies the style
354@code{substitute-command-keys} uses when generating left and right 354@code{substitute-command-keys} uses when generating left and right
355quotes. If the variable's value is @code{?‘} (U+2018 LEFT SINGLE 355quotes. If the variable's value is @code{curve}, the style is
356QUOTATION MARK), the style is @t{‘like this’} with curved single 356@t{‘like this’} with curved single quotes. If the value is
357quotes. If the value is @code{?'} (apostrophe), the style is @t{'like 357@code{straight}, the style is @t{'like this'} with straight
358this'} with apostrophes. If the value is @code{?`} (grave accent), 358apostrophes. If the value is @code{grave}, the style is @t{`like
359the style is @t{`like this'} with grave accent and apostrophe. The 359this'} with grave accent and apostrophe. The default value @code{nil}
360default value @code{nil} means to use curved single quotes if 360acts like @code{curve} if curved single quotes are displayable, and
361displayable, and grave accent and apostrophe otherwise. 361like @code{grave} otherwise.
362@end defvar 362@end defvar
363 363
364@defun substitute-command-keys string 364@defun substitute-command-keys string
diff --git a/etc/NEWS b/etc/NEWS
index 85df71607ee..e384d17e395 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -889,14 +889,14 @@ in languages like German where downcasing rules depend on grammar.
889+++ 889+++
890** substitute-command-keys now replaces quotes. 890** substitute-command-keys now replaces quotes.
891That is, it converts documentation strings' quoting style as per the 891That is, it converts documentation strings' quoting style as per the
892value of the new custom variable ‘help-quote-translation’: ?‘ means 892value of the new custom variable ‘text-quoting-style’: ‘curve’ means
893use curved quotes (also known as curly quotes) ‘like this’, ?' means 893use curved quotes (also known as curly quotes) ‘like this’, straight’
894use apostrophes 'like this', ?` means use grave accent and apostrophe 894means use straight apostrophes 'like this', ‘grave’ means use grave
895`like this', and nil (default) means use curved quotes if displayable 895accent and apostrophe `like this', and nil (default) means use curved
896and grave accent and apostrophe otherwise. Doc strings in source code 896quotes if displayable and grave accent and apostrophe otherwise. Doc
897can use either curved quotes or grave accent and apostrophe. As 897strings in source code can use either curved quotes or grave accent
898before, isolated apostrophes and characters preceded by \= are output 898and apostrophe. As before, isolated apostrophes and characters
899as-is. 899preceded by \= are output as-is.
900 900
901+++ 901+++
902** The character classes [:alpha:] and [:alnum:] in regular expressions 902** The character classes [:alpha:] and [:alnum:] in regular expressions
@@ -1017,8 +1017,8 @@ In the new Electric Quote mode, you can enter curved single quotes
1017into documentation by typing ` and '. Outside Electric Quote mode, 1017into documentation by typing ` and '. Outside Electric Quote mode,
1018you can enter them by typing ‘C-x 8 [’ and ‘C-x 8 ]’, or (if your Alt 1018you can enter them by typing ‘C-x 8 [’ and ‘C-x 8 ]’, or (if your Alt
1019key works) by typing ‘A-[’ and ‘A-]’. As described above under 1019key works) by typing ‘A-[’ and ‘A-]’. As described above under
1020help-quote-translation’, the user can specify how to display doc 1020text-quoting-style’, the user can specify how to display doc string
1021string quotes. 1021quotes.
1022 1022
1023+++ 1023+++
1024** show-help-function's arg is converted via substitute-command-keys 1024** show-help-function's arg is converted via substitute-command-keys
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 69dbf0d0c57..7a37198fb2c 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -221,14 +221,16 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
221 (no-redraw-on-reenter display boolean) 221 (no-redraw-on-reenter display boolean)
222 222
223 ;; doc.c 223 ;; doc.c
224 (help-quote-translation help 224 (text-quoting-style
225 (choice 225 help
226 (character :tag "Quote with curved quotes" 226 (choice
227 :value ?‘) 227 (const :tag "Quote with curved single quotes" curve)
228 (character :tag "Quote 'like this'" :value ?\') 228 (const :tag "Quote with straight apostrophes 'like this'"
229 (character :tag "Quote `like this'" :value ?\`) 229 straight)
230 (const :tag "Quote with curved quotes if displayable, 'like this' otherwise" nil)) 230 (const :tag "Quote with grave accent and apostrophe `like this'"
231 "25.1") 231 grave)
232 (const :tag "Use curved quotes if displayable, grave accent and apostrophe otherwise" nil))
233 "25.1")
232 ;; dosfns.c 234 ;; dosfns.c
233 (dos-display-scancodes display boolean) 235 (dos-display-scancodes display boolean)
234 (dos-hyper-key keyboard integer) 236 (dos-hyper-key keyboard integer)
diff --git a/src/doc.c b/src/doc.c
index 78a7815aade..36619e1142e 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -715,7 +715,7 @@ as the keymap for future \\=\\[COMMAND] substrings.
715Each \\=‘ and \\=’ are replaced by left and right quote. Each \\=` is 715Each \\=‘ and \\=’ are replaced by left and right quote. Each \\=` is
716replaced by left quote, and each ' preceded by \\=` and without 716replaced by left quote, and each ' preceded by \\=` and without
717intervening ' is replaced by right quote. Left and right quote 717intervening ' is replaced by right quote. Left and right quote
718characters are specified by ‘help-quote-translation’. 718characters are specified by ‘text-quoting-style’.
719 719
720\\=\\= quotes the following character and is discarded; thus, 720\\=\\= quotes the following character and is discarded; thus,
721\\=\\=\\=\\= puts \\=\\= into the output, \\=\\=\\=\\[ puts \\=\\[ into the output, and 721\\=\\=\\=\\= puts \\=\\= into the output, \\=\\=\\=\\[ puts \\=\\[ into the output, and
@@ -751,11 +751,11 @@ Otherwise, return a new string. */)
751 GCPRO4 (string, tem, keymap, name); 751 GCPRO4 (string, tem, keymap, name);
752 752
753 enum { unicode, grave_accent, apostrophe } quote_translation = unicode; 753 enum { unicode, grave_accent, apostrophe } quote_translation = unicode;
754 if (EQ (Vhelp_quote_translation, make_number ('`'))) 754 if (EQ (Vtext_quoting_style, Qgrave))
755 quote_translation = grave_accent; 755 quote_translation = grave_accent;
756 else if (EQ (Vhelp_quote_translation, make_number ('\''))) 756 else if (EQ (Vtext_quoting_style, Qstraight))
757 quote_translation = apostrophe; 757 quote_translation = apostrophe;
758 else if (NILP (Vhelp_quote_translation) 758 else if (NILP (Vtext_quoting_style)
759 && DISP_TABLE_P (Vstandard_display_table)) 759 && DISP_TABLE_P (Vstandard_display_table))
760 { 760 {
761 Lisp_Object dv = DISP_CHAR_VECTOR (XCHAR_TABLE (Vstandard_display_table), 761 Lisp_Object dv = DISP_CHAR_VECTOR (XCHAR_TABLE (Vstandard_display_table),
@@ -1024,6 +1024,8 @@ void
1024syms_of_doc (void) 1024syms_of_doc (void)
1025{ 1025{
1026 DEFSYM (Qfunction_documentation, "function-documentation"); 1026 DEFSYM (Qfunction_documentation, "function-documentation");
1027 DEFSYM (Qgrave, "grave");
1028 DEFSYM (Qstraight, "straight");
1027 1029
1028 DEFVAR_LISP ("internal-doc-file-name", Vdoc_file_name, 1030 DEFVAR_LISP ("internal-doc-file-name", Vdoc_file_name,
1029 doc: /* Name of file containing documentation strings of built-in symbols. */); 1031 doc: /* Name of file containing documentation strings of built-in symbols. */);
@@ -1033,15 +1035,14 @@ syms_of_doc (void)
1033 doc: /* A list of files used to build this Emacs binary. */); 1035 doc: /* A list of files used to build this Emacs binary. */);
1034 Vbuild_files = Qnil; 1036 Vbuild_files = Qnil;
1035 1037
1036 DEFVAR_LISP ("help-quote-translation", Vhelp_quote_translation, 1038 DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style,
1037 doc: /* Style to use for single quotes in help. 1039 doc: /* Style to use for single quotes when generating text.
1038The value is a left single quote character of some style. 1040‘curve’ means quote with curved single quotes \\=‘like this\\=’.
1039Quote \\=‘like this\\=’ if the value is ?\\=‘ (left single quotation mark). 1041‘straight’ means quote with straight apostrophes 'like this'.
1040Quote 'like this' if the value is ?' (apostrophe). 1042‘grave’ means quote with grave accent and apostrophe \\=`like this'.
1041Quote \\=`like this' if the value is ?\\=` (grave accent). 1043The default value nil acts like ‘curve’ if curved single quotes are
1042The default value is nil, which means quote with left single quotation mark 1044displayable, and like ‘grave’ otherwise. */);
1043if displayable, and with grave accent otherwise. */); 1045 Vtext_quoting_style = Qnil;
1044 Vhelp_quote_translation = Qnil;
1045 1046
1046 defsubr (&Sdocumentation); 1047 defsubr (&Sdocumentation);
1047 defsubr (&Sdocumentation_property); 1048 defsubr (&Sdocumentation_property);