aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2016-05-10 07:38:23 -0700
committerPaul Eggert2016-05-10 07:41:40 -0700
commit433d366dc7b053048abf710d790ff62421dd1570 (patch)
treef68895872dd0384664bb66a56371b64e5630db61
parent8939ae68d430ef272194ac64144ceb58ae0dbd3f (diff)
downloademacs-433d366dc7b053048abf710d790ff62421dd1570.tar.gz
emacs-433d366dc7b053048abf710d790ff62421dd1570.zip
'text-quoting-style' now affects only ` and '
Change 'text-quoting-style' so that it no longer affects formatting of curved quotes in format arguments to functions like 'message'. In particular, when this variable's value is 'grave', all quotes in formats are output as-is. * doc/lispref/help.texi (Keys in Documentation): * doc/lispref/strings.texi (Formatting Strings): * doc/lispref/tips.texi (Documentation Tips): * etc/NEWS: * src/doc.c (syms_of_doc): Document this. * lisp/help-fns.el (describe-function-1): * src/doc.c (text_quoting_style, Fsubstitute_command_keys) (syms_of_doc): * src/editfns.c (styled_format): Omit now-unnecessary code. * src/lisp.h (LEAVE_QUOTING_STYLE): Remove.
-rw-r--r--doc/lispref/help.texi13
-rw-r--r--doc/lispref/strings.texi5
-rw-r--r--doc/lispref/tips.texi3
-rw-r--r--etc/NEWS10
-rw-r--r--lisp/help-fns.el2
-rw-r--r--src/doc.c41
-rw-r--r--src/editfns.c22
-rw-r--r--src/lisp.h3
8 files changed, 29 insertions, 70 deletions
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index b945e438f55..1bb2c7c4d08 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -332,15 +332,13 @@ stands for no text itself. It is used only for a side effect: it
332specifies @var{mapvar}'s value as the keymap for any following 332specifies @var{mapvar}'s value as the keymap for any following
333@samp{\[@var{command}]} sequences in this documentation string. 333@samp{\[@var{command}]} sequences in this documentation string.
334 334
335@item ‘ 335@item `
336@itemx ` 336(grave accent) stands for a left quote.
337(left single quotation mark and grave accent) both stand for a left quote.
338This generates a left single quotation mark, an apostrophe, or a grave 337This generates a left single quotation mark, an apostrophe, or a grave
339accent depending on the value of @code{text-quoting-style}. 338accent depending on the value of @code{text-quoting-style}.
340 339
341@item ’ 340@item '
342@itemx ' 341(apostrophe) stands for a right quote.
343(right single quotation mark and apostrophe) both stand for a right quote.
344This generates a right single quotation mark or an apostrophe 342This generates a right single quotation mark or an apostrophe
345depending on the value of @code{text-quoting-style}. 343depending on the value of @code{text-quoting-style}.
346 344
@@ -361,7 +359,8 @@ should use for single quotes in the wording of help and messages.
361If the variable's value is @code{curve}, the style is 359If the variable's value is @code{curve}, the style is
362@t{‘like this’} with curved single quotes. If the value is 360@t{‘like this’} with curved single quotes. If the value is
363@code{straight}, the style is @t{'like this'} with straight 361@code{straight}, the style is @t{'like this'} with straight
364apostrophes. If the value is @code{grave}, the style is @t{`like 362apostrophes. If the value is @code{grave},
363quotes are not translated and the style is @t{`like
365this'} with grave accent and apostrophe, the standard style 364this'} with grave accent and apostrophe, the standard style
366before Emacs version 25. The default value @code{nil} 365before Emacs version 25. The default value @code{nil}
367acts like @code{curve} if curved single quotes are displayable, and 366acts like @code{curve} if curved single quotes are displayable, and
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 58ab02dbc41..cf0505f4467 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -840,9 +840,8 @@ if any.
840@cindex curved quotes 840@cindex curved quotes
841@cindex curly quotes 841@cindex curly quotes
842This function acts like @code{format}, except it also converts any 842This function acts like @code{format}, except it also converts any
843curved single quotes in @var{string} as per the value of 843grave accents (@t{`}) and apostrophes (@t{'}) in @var{string} as per the
844@code{text-quoting-style}, and treats grave accent (@t{`}) and 844value of @code{text-quoting-style}.
845apostrophe (@t{'}) as if they were curved single quotes.
846 845
847A format that quotes with grave accents and apostrophes @t{`like 846A format that quotes with grave accents and apostrophes @t{`like
848this'} typically generates curved quotes @t{‘like this’}. In 847this'} typically generates curved quotes @t{‘like this’}. In
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index d12de7aee2d..a8589df031c 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -679,8 +679,7 @@ which quotes symbols with grave accent @t{`} and apostrophe
679@t{'}: @t{`like-this'} rather than @t{‘like-this’}. This 679@t{'}: @t{`like-this'} rather than @t{‘like-this’}. This
680older convention was designed for now-obsolete displays in which grave 680older convention was designed for now-obsolete displays in which grave
681accent and apostrophe were mirror images. 681accent and apostrophe were mirror images.
682 682Documentation using this convention is converted to the user's
683Documentation using either convention is converted to the user's
684preferred format when it is copied into a help buffer. @xref{Keys in 683preferred format when it is copied into a help buffer. @xref{Keys in
685Documentation}. 684Documentation}.
686 685
diff --git a/etc/NEWS b/etc/NEWS
index b4407a661ad..ed0bc5f7626 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -207,7 +207,7 @@ viewing HTML files and the like.
207 207
208*** Ediff can be prevented from pausing 1 second after reaching a 208*** Ediff can be prevented from pausing 1 second after reaching a
209breakpoint (e.g. with "f" and "o") by customizing the new option 209breakpoint (e.g. with "f" and "o") by customizing the new option
210`edebug-sit-on-break'. 210'edebug-sit-on-break'.
211 211
212** eww 212** eww
213 213
@@ -364,13 +364,19 @@ mode bindings: 'C-c @ C-a', 'C-c @ C-t', 'C-c @ C-d', and 'C-c @ C-e.'
364before running. This is controlled by the 'grep-save-buffers' 364before running. This is controlled by the 'grep-save-buffers'
365variable. 365variable.
366 366
367+++
368** The variable 'text-quoting-style' no longer affects the treatment
369of curved quotes in format arguments to functions like 'message' and
370'format-message'. In particular, when this variable's value is
371'grave', all quotes in formats are output as-is.
372
367 373
368* Lisp Changes in Emacs 25.2 374* Lisp Changes in Emacs 25.2
369 375
370** New var syntax-ppss-table to control the syntax-table used in syntax-ppss. 376** New var syntax-ppss-table to control the syntax-table used in syntax-ppss.
371 377
372+++ 378+++
373** `define-derived-mode' can now specify an :after-hook form, which 379** 'define-derived-mode' can now specify an :after-hook form, which
374gets evaluated after the new mode's hook has run. This can be used to 380gets evaluated after the new mode's hook has run. This can be used to
375incorporate configuration changes made in the mode hook into the 381incorporate configuration changes made in the mode hook into the
376mode's setup. 382mode's setup.
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index d1c8b2dc478..040152a2c9f 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -626,7 +626,7 @@ FILE is the file where FUNCTION was probably defined."
626 ;; Avoid asking the user annoying questions if she decides 626 ;; Avoid asking the user annoying questions if she decides
627 ;; to save the help buffer, when her locale's codeset 627 ;; to save the help buffer, when her locale's codeset
628 ;; isn't UTF-8. 628 ;; isn't UTF-8.
629 (unless (memq text-quoting-style '(leave straight grave)) 629 (unless (memq text-quoting-style '(straight grave))
630 (set-buffer-file-coding-system 'utf-8)))))))) 630 (set-buffer-file-coding-system 'utf-8))))))))
631 631
632;; Add defaults to `help-fns-describe-function-functions'. 632;; Add defaults to `help-fns-describe-function-functions'.
diff --git a/src/doc.c b/src/doc.c
index 53264334ed5..017dd173d0a 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -704,8 +704,6 @@ text_quoting_style (void)
704 ? default_to_grave_quoting_style () 704 ? default_to_grave_quoting_style ()
705 : EQ (Vtext_quoting_style, Qgrave)) 705 : EQ (Vtext_quoting_style, Qgrave))
706 return GRAVE_QUOTING_STYLE; 706 return GRAVE_QUOTING_STYLE;
707 else if (EQ (Vtext_quoting_style, Qleave))
708 return LEAVE_QUOTING_STYLE;
709 else if (EQ (Vtext_quoting_style, Qstraight)) 707 else if (EQ (Vtext_quoting_style, Qstraight))
710 return STRAIGHT_QUOTING_STYLE; 708 return STRAIGHT_QUOTING_STYLE;
711 else 709 else
@@ -982,29 +980,12 @@ Otherwise, return a new string. */)
982 nchars++; 980 nchars++;
983 changed = true; 981 changed = true;
984 } 982 }
985 else if (! multibyte)
986 *bufp++ = *strp++, nchars++;
987 else 983 else
988 { 984 {
989 int len; 985 *bufp++ = *strp++;
990 int ch = STRING_CHAR_AND_LENGTH (strp, len); 986 if (multibyte)
991 if ((ch == LEFT_SINGLE_QUOTATION_MARK 987 while (! CHAR_HEAD_P (*strp))
992 || ch == RIGHT_SINGLE_QUOTATION_MARK) 988 *bufp++ = *strp++;
993 && quoting_style != CURVE_QUOTING_STYLE
994 && quoting_style != LEAVE_QUOTING_STYLE)
995 {
996 *bufp++ = ((ch == LEFT_SINGLE_QUOTATION_MARK
997 && quoting_style == GRAVE_QUOTING_STYLE)
998 ? '`' : '\'');
999 strp += len;
1000 changed = true;
1001 }
1002 else
1003 {
1004 do
1005 *bufp++ = *strp++;
1006 while (--len != 0);
1007 }
1008 nchars++; 989 nchars++;
1009 } 990 }
1010 } 991 }
@@ -1036,7 +1017,6 @@ void
1036syms_of_doc (void) 1017syms_of_doc (void)
1037{ 1018{
1038 DEFSYM (Qfunction_documentation, "function-documentation"); 1019 DEFSYM (Qfunction_documentation, "function-documentation");
1039 DEFSYM (Qleave, "leave");
1040 DEFSYM (Qgrave, "grave"); 1020 DEFSYM (Qgrave, "grave");
1041 DEFSYM (Qstraight, "straight"); 1021 DEFSYM (Qstraight, "straight");
1042 1022
@@ -1051,15 +1031,16 @@ syms_of_doc (void)
1051 DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style, 1031 DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style,
1052 doc: /* Style to use for single quotes in help and messages. 1032 doc: /* Style to use for single quotes in help and messages.
1053Its value should be a symbol. It works by substituting certain single 1033Its value should be a symbol. It works by substituting certain single
1054quotes for certain other single quotes. This is done in help output and 1034quotes for grave accent and apostrophe. This is done in help output
1055`message' output. It is not done in `format'. 1035and in functions like `message' and `format-message'. It is not done
1036in `format'.
1056 1037
1057`leave' means do not do any substitutions.
1058`curve' means quote with curved single quotes \\=‘like this\\=’. 1038`curve' means quote with curved single quotes \\=‘like this\\=’.
1059`straight' means quote with straight apostrophes \\='like this\\='. 1039`straight' means quote with straight apostrophes \\='like this\\='.
1060`grave' means quote with grave accent and apostrophe \\=`like this\\='. 1040`grave' means quote with grave accent and apostrophe \\=`like this\\=';
1061The default value nil acts like `curve' if curved single quotes are 1041i.e., do not alter quote marks. The default value nil acts like
1062displayable, and like `grave' otherwise. */); 1042`curve' if curved single quotes are displayable, and like `grave'
1043otherwise. */);
1063 Vtext_quoting_style = Qnil; 1044 Vtext_quoting_style = Qnil;
1064 1045
1065 DEFVAR_BOOL ("internal--text-quoting-flag", text_quoting_flag, 1046 DEFVAR_BOOL ("internal--text-quoting-flag", text_quoting_flag,
diff --git a/src/editfns.c b/src/editfns.c
index afcf1cab72b..6b0996d65eb 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3977,8 +3977,6 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
3977 multibyte = true; 3977 multibyte = true;
3978 3978
3979 int quoting_style = message ? text_quoting_style () : -1; 3979 int quoting_style = message ? text_quoting_style () : -1;
3980 if (quoting_style == LEAVE_QUOTING_STYLE)
3981 quoting_style = -1;
3982 3980
3983 /* If we start out planning a unibyte result, 3981 /* If we start out planning a unibyte result,
3984 then discover it has to be multibyte, we jump back to retry. */ 3982 then discover it has to be multibyte, we jump back to retry. */
@@ -4457,14 +4455,6 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
4457 } 4455 }
4458 else 4456 else
4459 { 4457 {
4460 /* Named constants for the UTF-8 encodings of U+2018 LEFT SINGLE
4461 QUOTATION MARK and U+2019 RIGHT SINGLE QUOTATION MARK. */
4462 enum
4463 {
4464 uLSQM0 = 0xE2, uLSQM1 = 0x80, uLSQM2 = 0x98,
4465 /* uRSQM0 = 0xE2, uRSQM1 = 0x80, */ uRSQM2 = 0x99
4466 };
4467
4468 unsigned char str[MAX_MULTIBYTE_LENGTH]; 4458 unsigned char str[MAX_MULTIBYTE_LENGTH];
4469 4459
4470 if ((format_char == '`' || format_char == '\'') 4460 if ((format_char == '`' || format_char == '\'')
@@ -4480,18 +4470,6 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
4480 } 4470 }
4481 else if (format_char == '`' && quoting_style == STRAIGHT_QUOTING_STYLE) 4471 else if (format_char == '`' && quoting_style == STRAIGHT_QUOTING_STYLE)
4482 convsrc = "'"; 4472 convsrc = "'";
4483 else if (format_char == uLSQM0 && CURVE_QUOTING_STYLE < quoting_style
4484 && multibyte_format
4485 && (unsigned char) format[0] == uLSQM1
4486 && ((unsigned char) format[1] == uLSQM2
4487 || (unsigned char) format[1] == uRSQM2))
4488 {
4489 convsrc = (((unsigned char) format[1] == uLSQM2
4490 && quoting_style == GRAVE_QUOTING_STYLE)
4491 ? "`" : "'");
4492 format += 2;
4493 memset (&discarded[format0 + 1 - format_start], 2, 2);
4494 }
4495 else 4473 else
4496 { 4474 {
4497 /* Copy a single character from format to buf. */ 4475 /* Copy a single character from format to buf. */
diff --git a/src/lisp.h b/src/lisp.h
index de74a47e3d3..1fc6130be0b 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4198,9 +4198,6 @@ extern void syms_of_callproc (void);
4198/* Defined in doc.c. */ 4198/* Defined in doc.c. */
4199enum text_quoting_style 4199enum text_quoting_style
4200 { 4200 {
4201 /* Leave quotes unchanged. */
4202 LEAVE_QUOTING_STYLE,
4203
4204 /* Use curved single quotes ‘like this’. */ 4201 /* Use curved single quotes ‘like this’. */
4205 CURVE_QUOTING_STYLE, 4202 CURVE_QUOTING_STYLE,
4206 4203