diff options
| author | Alan Mackenzie | 2017-09-30 11:08:16 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2017-10-01 11:27:16 +0000 |
| commit | 8c18dcbc784a97196d6513e5556de48af4cea617 (patch) | |
| tree | c929074b0c9d9e6eabbefac9326c90dc4511d06c /doc | |
| parent | 5f76ac150a28e4de940790f96f0f751c8ee5d4c7 (diff) | |
| download | emacs-8c18dcbc784a97196d6513e5556de48af4cea617.tar.gz emacs-8c18dcbc784a97196d6513e5556de48af4cea617.zip | |
Amend documentation for text-quoting-style becoming a user option.
* doc/lispref/control.texi (Signaling Errors):
* doc/lispref/display.texi (Displaying Messages):
* doc/lispref/strings.texi (Formatting Strings):
Edit for brevity, farming out the details to the new
Text Quoting Style node.
* doc/lispref/help.texi (Text Quoting Style): New section.
Move detailed discussion of text-quoting-style here.
Add discussion about how to output grave accent and apostrophe in
documentation and messages. Adjust xrefs to point to this section
when appropriate.
* etc/NEWS: text-quoting-style semantics have not changed.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/control.texi | 14 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 16 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/help.texi | 49 | ||||
| -rw-r--r-- | doc/lispref/strings.texi | 14 | ||||
| -rw-r--r-- | doc/lispref/syntax.texi | 13 |
6 files changed, 70 insertions, 37 deletions
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index c39e035459e..4eddbe9c122 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi | |||
| @@ -1101,16 +1101,10 @@ These examples show typical uses of @code{error}: | |||
| 1101 | error symbol @code{error}, and a list containing the string returned by | 1101 | error symbol @code{error}, and a list containing the string returned by |
| 1102 | @code{format-message}. | 1102 | @code{format-message}. |
| 1103 | 1103 | ||
| 1104 | The @code{text-quoting-style} variable controls what quotes are | 1104 | Typically grave accent and apostrophe in the format translate to |
| 1105 | generated; @xref{Keys in Documentation}. A call using a format like | 1105 | matching curved quotes, e.g., @t{"Missing `%s'"} might result in |
| 1106 | @t{"Missing `%s'"} with grave accents and apostrophes typically | 1106 | @t{"Missing ‘foo’"}. @xref{Text Quoting Style}, for how to influence |
| 1107 | generates a message like @t{"Missing ‘foo’"} with matching curved | 1107 | or inhibit this translation. |
| 1108 | quotes. In contrast, a call using a format like @t{"Missing '%s'"} | ||
| 1109 | with only apostrophes typically generates a message like @t{"Missing | ||
| 1110 | ’foo’"} with only closing curved quotes, an unusual style in English. | ||
| 1111 | One way around this problem is to bind @code{text-quoting-style} to | ||
| 1112 | the symbol @code{grave} around the call to @code{error}; this causes | ||
| 1113 | @acronym{ASCII} quote characters to be output unchanged. | ||
| 1114 | 1108 | ||
| 1115 | @strong{Warning:} If you want to use your own string as an error message | 1109 | @strong{Warning:} If you want to use your own string as an error message |
| 1116 | verbatim, don't just write @code{(error @var{string})}. If @var{string} | 1110 | verbatim, don't just write @code{(error @var{string})}. If @var{string} |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 62b136f6c60..afd09cfb330 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -265,16 +265,10 @@ properties, it is displayed with the specified faces (@pxref{Faces}). | |||
| 265 | The string is also added to the @file{*Messages*} buffer, but without | 265 | The string is also added to the @file{*Messages*} buffer, but without |
| 266 | text properties (@pxref{Logging Messages}). | 266 | text properties (@pxref{Logging Messages}). |
| 267 | 267 | ||
| 268 | The @code{text-quoting-style} variable controls what quotes are | 268 | Typically grave accent and apostrophe in the format translate to |
| 269 | generated; @xref{Keys in Documentation}. A call using a format like | 269 | matching curved quotes, e.g., @t{"Missing `%s'"} might result in |
| 270 | @t{"Missing `%s'"} with grave accents and apostrophes typically | 270 | @t{"Missing ‘foo’"}. @xref{Text Quoting Style}, for how to influence |
| 271 | generates a message like @t{"Missing ‘foo’"} with matching curved | 271 | or inhibit this translation. |
| 272 | quotes. In contrast, a call using a format like @t{"Missing '%s'"} | ||
| 273 | with only apostrophes typically generates a message like @t{"Missing | ||
| 274 | ’foo’"} with only closing curved quotes, an unusual style in English. | ||
| 275 | One way around this problem is to bind @code{text-quoting-style} to | ||
| 276 | the symbol @code{grave} around calls to @code{message}; this causes | ||
| 277 | @acronym{ASCII} quote characters to be output unchanged. | ||
| 278 | 272 | ||
| 279 | In batch mode, the message is printed to the standard error stream, | 273 | In batch mode, the message is printed to the standard error stream, |
| 280 | followed by a newline. | 274 | followed by a newline. |
| @@ -7038,7 +7032,7 @@ window display table nor a buffer display table defined, or when Emacs | |||
| 7038 | is outputting text to the standard output or error streams. Although its | 7032 | is outputting text to the standard output or error streams. Although its |
| 7039 | default is typically @code{nil}, in an interactive session if the | 7033 | default is typically @code{nil}, in an interactive session if the |
| 7040 | terminal cannot display curved quotes, its default maps curved quotes | 7034 | terminal cannot display curved quotes, its default maps curved quotes |
| 7041 | to ASCII approximations. @xref{Keys in Documentation}. | 7035 | to ASCII approximations. @xref{Text Quoting Style}. |
| 7042 | @end defvar | 7036 | @end defvar |
| 7043 | 7037 | ||
| 7044 | The @file{disp-table} library defines several functions for changing | 7038 | The @file{disp-table} library defines several functions for changing |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 4cbcdf855d1..c7525945845 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -940,6 +940,7 @@ Documentation | |||
| 940 | * Documentation Basics:: Where doc strings are defined and stored. | 940 | * Documentation Basics:: Where doc strings are defined and stored. |
| 941 | * Accessing Documentation:: How Lisp programs can access doc strings. | 941 | * Accessing Documentation:: How Lisp programs can access doc strings. |
| 942 | * Keys in Documentation:: Substituting current key bindings. | 942 | * Keys in Documentation:: Substituting current key bindings. |
| 943 | * Text Quoting Style:: Quotation marks in doc strings and messages. | ||
| 943 | * Describing Characters:: Making printable descriptions of | 944 | * Describing Characters:: Making printable descriptions of |
| 944 | non-printing characters and key sequences. | 945 | non-printing characters and key sequences. |
| 945 | * Help Functions:: Subroutines used by Emacs help facilities. | 946 | * Help Functions:: Subroutines used by Emacs help facilities. |
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 74dc6dac9cb..4aa9b95180e 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi | |||
| @@ -33,6 +33,7 @@ Help, emacs, The GNU Emacs Manual}. | |||
| 33 | * Documentation Basics:: Where doc strings are defined and stored. | 33 | * Documentation Basics:: Where doc strings are defined and stored. |
| 34 | * Accessing Documentation:: How Lisp programs can access doc strings. | 34 | * Accessing Documentation:: How Lisp programs can access doc strings. |
| 35 | * Keys in Documentation:: Substituting current key bindings. | 35 | * Keys in Documentation:: Substituting current key bindings. |
| 36 | * Text Quoting Style:: Quotation marks in doc strings and messages. | ||
| 36 | * Describing Characters:: Making printable descriptions of | 37 | * Describing Characters:: Making printable descriptions of |
| 37 | non-printing characters and key sequences. | 38 | non-printing characters and key sequences. |
| 38 | * Help Functions:: Subroutines used by Emacs help facilities. | 39 | * Help Functions:: Subroutines used by Emacs help facilities. |
| @@ -336,6 +337,7 @@ specifies @var{mapvar}'s value as the keymap for any following | |||
| 336 | (grave accent) stands for a left quote. | 337 | (grave accent) stands for a left quote. |
| 337 | This generates a left single quotation mark, an apostrophe, or a grave | 338 | This generates a left single quotation mark, an apostrophe, or a grave |
| 338 | accent depending on the value of @code{text-quoting-style}. | 339 | accent depending on the value of @code{text-quoting-style}. |
| 340 | @xref{Text Quoting Style}. | ||
| 339 | 341 | ||
| 340 | @item ' | 342 | @item ' |
| 341 | (apostrophe) stands for a right quote. | 343 | (apostrophe) stands for a right quote. |
| @@ -428,6 +430,53 @@ C-g abort-recursive-edit | |||
| 428 | strings---for instance, you can refer to functions, variables, and | 430 | strings---for instance, you can refer to functions, variables, and |
| 429 | sections of this manual. @xref{Documentation Tips}, for details. | 431 | sections of this manual. @xref{Documentation Tips}, for details. |
| 430 | 432 | ||
| 433 | @node Text Quoting Style | ||
| 434 | @section Text Quoting Style | ||
| 435 | |||
| 436 | Typically, grave accents and apostrophes are treated specially in | ||
| 437 | documentation strings and diagnostic messages, and translate to matching | ||
| 438 | single quotation marks (also called ``curved quotes''). For example, | ||
| 439 | the documentation string @t{"Alias for `foo'."} and the function call | ||
| 440 | @code{(message "Alias for `foo'.")} both translate to @t{"Alias for | ||
| 441 | ‘foo’."}. Less commonly, Emacs displays grave accents and apostrophes | ||
| 442 | as themselves, or as apostrophes only (e.g., @t{"Alias for 'foo'."}). | ||
| 443 | Documentation strings and message formats should be written so that | ||
| 444 | they display well with any of these styles. For example, the | ||
| 445 | documentation string @t{"Alias for 'foo'."} is probably not what you | ||
| 446 | want, as it can display as @t{"Alias for ’foo’."}, an unusual style in | ||
| 447 | English. | ||
| 448 | |||
| 449 | Sometimes you may need to display a grave accent or apostrophe | ||
| 450 | without translation, regardless of text quoting style. In a | ||
| 451 | documentation string, you can do this with escapes. For example, in | ||
| 452 | the documentation string @t{"\\=`(a ,(sin 0)) ==> (a 0.0)"} the grave | ||
| 453 | accent is intended to denote Lisp code, so it is escaped and displays | ||
| 454 | as itself regardless of quoting style. In a call to @code{message} or | ||
| 455 | @code{error}, you can avoid translation by using a format @t{"%s"} | ||
| 456 | with an argument that is a call to @code{format}. For example, | ||
| 457 | @code{(message "%s" (format "`(a ,(sin %S)) ==> (a %S)" x (sin x)))} | ||
| 458 | displays a message that starts with grave accent regardless of text | ||
| 459 | quoting style. | ||
| 460 | |||
| 461 | @defopt text-quoting-style | ||
| 462 | @cindex curved quotes | ||
| 463 | @cindex curly quotes | ||
| 464 | The value of this user option is a symbol that specifies the style | ||
| 465 | Emacs should use for single quotes in the wording of help and | ||
| 466 | messages. If the option's value is @code{curve}, the style is | ||
| 467 | @t{‘like this’} with curved single quotes. If the value is | ||
| 468 | @code{straight}, the style is @t{'like this'} with straight | ||
| 469 | apostrophes. If the value is @code{grave}, quotes are not translated | ||
| 470 | and the style is @t{`like this'} with grave accent and apostrophe, the | ||
| 471 | standard style before Emacs version 25. The default value @code{nil} | ||
| 472 | acts like @code{curve} if curved single quotes seem to be displayable, | ||
| 473 | and like @code{grave} otherwise. | ||
| 474 | |||
| 475 | This option is useful on platforms that have problems with curved | ||
| 476 | quotes. You can customize it freely according to your personal | ||
| 477 | preference. | ||
| 478 | @end defopt | ||
| 479 | |||
| 431 | @node Describing Characters | 480 | @node Describing Characters |
| 432 | @section Describing Characters for Help Messages | 481 | @section Describing Characters for Help Messages |
| 433 | @cindex describe characters and events | 482 | @cindex describe characters and events |
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 10385e05501..dd004927caf 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -826,20 +826,14 @@ to the produced string representations of the argument @var{objects}. | |||
| 826 | @defun format-message string &rest objects | 826 | @defun format-message string &rest objects |
| 827 | @cindex curved quotes, in formatted messages | 827 | @cindex curved quotes, in formatted messages |
| 828 | @cindex curly quotes, in formatted messages | 828 | @cindex curly quotes, in formatted messages |
| 829 | @cindex @code{text-quoting-style}, and formatting messages | ||
| 830 | This function acts like @code{format}, except it also converts any | 829 | This function acts like @code{format}, except it also converts any |
| 831 | grave accents (@t{`}) and apostrophes (@t{'}) in @var{string} as per the | 830 | grave accents (@t{`}) and apostrophes (@t{'}) in @var{string} as per the |
| 832 | value of @code{text-quoting-style}. | 831 | value of @code{text-quoting-style}. |
| 833 | 832 | ||
| 834 | A format that quotes with grave accents and apostrophes @t{`like | 833 | Typically grave accent and apostrophe in the format translate to |
| 835 | this'} typically generates curved quotes @t{‘like this’}. In | 834 | matching curved quotes, e.g., @t{"Missing `%s'"} might result in |
| 836 | contrast, a format that quotes with only apostrophes @t{'like this'} | 835 | @t{"Missing ‘foo’"}. @xref{Text Quoting Style}, for how to influence |
| 837 | typically generates two closing curved quotes @t{’like this’}, an | 836 | or inhibit this translation. |
| 838 | unusual style in English. One way around such problems is to bind | ||
| 839 | @code{text-quoting-style} to the symbol @code{grave} around calls to | ||
| 840 | @code{format-message}; this causes @acronym{ASCII} quoting characters | ||
| 841 | to be output unchanged. @xref{Keys in Documentation}, for how the | ||
| 842 | @code{text-quoting-style} variable affects generated quotes. | ||
| 843 | @end defun | 837 | @end defun |
| 844 | 838 | ||
| 845 | @cindex @samp{%} in format | 839 | @cindex @samp{%} in format |
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index e3ae53536f9..b37f2b22b82 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi | |||
| @@ -751,7 +751,8 @@ position. This function does that conveniently. | |||
| 751 | 751 | ||
| 752 | @defun syntax-ppss &optional pos | 752 | @defun syntax-ppss &optional pos |
| 753 | This function returns the parser state that the parser would reach at | 753 | This function returns the parser state that the parser would reach at |
| 754 | position @var{pos} starting from the beginning of the buffer. | 754 | position @var{pos} starting from the beginning of the visible portion |
| 755 | of the buffer. | ||
| 755 | @iftex | 756 | @iftex |
| 756 | See the next section for | 757 | See the next section for |
| 757 | @end iftex | 758 | @end iftex |
| @@ -762,11 +763,11 @@ for a description of the parser state. | |||
| 762 | 763 | ||
| 763 | The return value is the same as if you call the low-level parsing | 764 | The return value is the same as if you call the low-level parsing |
| 764 | function @code{parse-partial-sexp} to parse from the beginning of the | 765 | function @code{parse-partial-sexp} to parse from the beginning of the |
| 765 | buffer to @var{pos} (@pxref{Low-Level Parsing}). However, | 766 | visible portion of the buffer to @var{pos} (@pxref{Low-Level |
| 766 | @code{syntax-ppss} uses a cache to speed up the computation. Due to | 767 | Parsing}). However, @code{syntax-ppss} uses caches to speed up the |
| 767 | this optimization, the second value (previous complete subexpression) | 768 | computation. Due to this optimization, the second value (previous |
| 768 | and sixth value (minimum parenthesis depth) in the returned parser | 769 | complete subexpression) and sixth value (minimum parenthesis depth) in |
| 769 | state are not meaningful. | 770 | the returned parser state are not meaningful. |
| 770 | 771 | ||
| 771 | This function has a side effect: it adds a buffer-local entry to | 772 | This function has a side effect: it adds a buffer-local entry to |
| 772 | @code{before-change-functions} (@pxref{Change Hooks}) for | 773 | @code{before-change-functions} (@pxref{Change Hooks}) for |