diff options
| author | Paul Eggert | 2016-05-03 08:02:16 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-05-03 08:03:04 -0700 |
| commit | 2ea2a2f1a5b5b2e1b20f1ee8c86058334d0a2652 (patch) | |
| tree | 0a7120c29c00676f6e8f3599227c2ecfc37b5e26 | |
| parent | 8544b9879c652e7c700652a4ba6fd17245163bd4 (diff) | |
| download | emacs-2ea2a2f1a5b5b2e1b20f1ee8c86058334d0a2652.tar.gz emacs-2ea2a2f1a5b5b2e1b20f1ee8c86058334d0a2652.zip | |
Doc fixes for quoting
* doc/emacs/text.texi, doc/lispintro/emacs-lisp-intro.texi:
* doc/lispref/control.texi, doc/lispref/display.texi:
* doc/lispref/help.texi, doc/lispref/strings.texi, lisp/subr.el:
* src/callint.c, src/doprnt.c, src/editfns.c:
Document quoting a bit more systematically.
Problem reported by Alan Mackenzie (Bug#23425).
| -rw-r--r-- | doc/emacs/text.texi | 4 | ||||
| -rw-r--r-- | doc/lispintro/emacs-lisp-intro.texi | 28 | ||||
| -rw-r--r-- | doc/lispref/control.texi | 10 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 10 | ||||
| -rw-r--r-- | doc/lispref/help.texi | 4 | ||||
| -rw-r--r-- | doc/lispref/strings.texi | 10 | ||||
| -rw-r--r-- | lisp/subr.el | 14 | ||||
| -rw-r--r-- | src/callint.c | 2 | ||||
| -rw-r--r-- | src/doprnt.c | 6 | ||||
| -rw-r--r-- | src/editfns.c | 13 |
10 files changed, 59 insertions, 42 deletions
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 66f01b495d1..579f7880cfe 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi | |||
| @@ -862,8 +862,8 @@ indenting the current line. @xref{Indentation}, for details. | |||
| 862 | 862 | ||
| 863 | Text mode turns off the features concerned with comments except when | 863 | Text mode turns off the features concerned with comments except when |
| 864 | you explicitly invoke them. It changes the syntax table so that | 864 | you explicitly invoke them. It changes the syntax table so that |
| 865 | single-quotes are considered part of words (e.g., @samp{don't} is | 865 | apostrophes are considered part of words (e.g., @samp{don't} is |
| 866 | considered one word). However, if a word starts with a single-quote, | 866 | considered one word). However, if a word starts with an apostrophe, |
| 867 | it is treated as a prefix for the purposes of capitalization | 867 | it is treated as a prefix for the purposes of capitalization |
| 868 | (e.g., @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as | 868 | (e.g., @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as |
| 869 | expected). | 869 | expected). |
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 78c1865703e..eea46af6b19 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi | |||
| @@ -1004,11 +1004,11 @@ the name stands for ``Lots of Isolated Silly Parentheses''. But the | |||
| 1004 | claim is unwarranted. Lisp stands for LISt Processing, and the | 1004 | claim is unwarranted. Lisp stands for LISt Processing, and the |
| 1005 | programming language handles @emph{lists} (and lists of lists) by | 1005 | programming language handles @emph{lists} (and lists of lists) by |
| 1006 | putting them between parentheses. The parentheses mark the boundaries | 1006 | putting them between parentheses. The parentheses mark the boundaries |
| 1007 | of the list. Sometimes a list is preceded by a single apostrophe or | 1007 | of the list. Sometimes a list is preceded by an apostrophe @samp{'}, |
| 1008 | quotation mark, @samp{'}@footnote{The single apostrophe or quotation | 1008 | called a @dfn{single-quote} in Lisp.@footnote{A single-quote is an |
| 1009 | mark is an abbreviation for the function @code{quote}; you need not | 1009 | abbreviation for the special form @code{quote}; you need not think |
| 1010 | think about functions now; functions are defined in @ref{Making | 1010 | about special forms now. @xref{Complications}.} Lists are the basis |
| 1011 | Errors, , Generate an Error Message}.} Lists are the basis of Lisp. | 1011 | of Lisp. |
| 1012 | 1012 | ||
| 1013 | @menu | 1013 | @menu |
| 1014 | * Lisp Lists:: What are lists? | 1014 | * Lisp Lists:: What are lists? |
| @@ -2490,14 +2490,7 @@ in the list and then at the function definition bound to that symbol. | |||
| 2490 | Then the instructions in the function definition are carried out. | 2490 | Then the instructions in the function definition are carried out. |
| 2491 | 2491 | ||
| 2492 | @item | 2492 | @item |
| 2493 | A single quotation mark, | 2493 | A single-quote @samp{'} tells the Lisp interpreter that it should |
| 2494 | @ifinfo | ||
| 2495 | ' | ||
| 2496 | @end ifinfo | ||
| 2497 | @ifnotinfo | ||
| 2498 | @code{'} | ||
| 2499 | @end ifnotinfo | ||
| 2500 | , tells the Lisp interpreter that it should | ||
| 2501 | return the following expression as written, and not evaluate it as it | 2494 | return the following expression as written, and not evaluate it as it |
| 2502 | would if the quote were not there. | 2495 | would if the quote were not there. |
| 2503 | 2496 | ||
| @@ -7610,7 +7603,8 @@ displays in which grave accent and apostrophe were often mirror images | |||
| 7610 | suitable for use as quotes. On most modern displays this is no longer | 7603 | suitable for use as quotes. On most modern displays this is no longer |
| 7611 | true, and when these two ASCII characters appear in documentation | 7604 | true, and when these two ASCII characters appear in documentation |
| 7612 | strings or diagnostic message formats, Emacs typically transliterates | 7605 | strings or diagnostic message formats, Emacs typically transliterates |
| 7613 | them to curved single quotes, so that the abovequoted symbol appears | 7606 | them to @dfn{curved quotes} (left and right single quotation marks), |
| 7607 | so that the abovequoted symbol appears | ||
| 7614 | as @t{‘case-fold-search’}. Source-code strings can also simply use | 7608 | as @t{‘case-fold-search’}. Source-code strings can also simply use |
| 7615 | curved quotes directly. | 7609 | curved quotes directly. |
| 7616 | 7610 | ||
| @@ -17117,7 +17111,7 @@ This line is a short, but complete Emacs Lisp expression. | |||
| 17117 | 17111 | ||
| 17118 | We are already familiar with @code{setq}. It sets the following variable, | 17112 | We are already familiar with @code{setq}. It sets the following variable, |
| 17119 | @code{major-mode}, to the subsequent value, which is @code{text-mode}. | 17113 | @code{major-mode}, to the subsequent value, which is @code{text-mode}. |
| 17120 | The single quote mark before @code{text-mode} tells Emacs to deal directly | 17114 | The single-quote before @code{text-mode} tells Emacs to deal directly |
| 17121 | with the @code{text-mode} symbol, not with whatever it might stand for. | 17115 | with the @code{text-mode} symbol, not with whatever it might stand for. |
| 17122 | @xref{set & setq, , Setting the Value of a Variable}, | 17116 | @xref{set & setq, , Setting the Value of a Variable}, |
| 17123 | for a reminder of how @code{setq} works. | 17117 | for a reminder of how @code{setq} works. |
| @@ -17284,11 +17278,11 @@ Rebinding Keys in Your Init File, emacs, The GNU Emacs Manual}, for | |||
| 17284 | details.) | 17278 | details.) |
| 17285 | 17279 | ||
| 17286 | The command invoked by the keys is @code{compare-windows}. Note that | 17280 | The command invoked by the keys is @code{compare-windows}. Note that |
| 17287 | @code{compare-windows} is preceded by a single quote; otherwise, Emacs | 17281 | @code{compare-windows} is preceded by a single-quote; otherwise, Emacs |
| 17288 | would first try to evaluate the symbol to determine its value. | 17282 | would first try to evaluate the symbol to determine its value. |
| 17289 | 17283 | ||
| 17290 | These three things, the double quotation marks, the backslash before | 17284 | These three things, the double quotation marks, the backslash before |
| 17291 | the @samp{C}, and the single quote mark are necessary parts of | 17285 | the @samp{C}, and the single-quote are necessary parts of |
| 17292 | keybinding that I tend to forget. Fortunately, I have come to | 17286 | keybinding that I tend to forget. Fortunately, I have come to |
| 17293 | remember that I should look at my existing @file{.emacs} file, and | 17287 | remember that I should look at my existing @file{.emacs} file, and |
| 17294 | adapt what is there. | 17288 | adapt what is there. |
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 3f48c458c02..75d8d284623 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi | |||
| @@ -1100,10 +1100,12 @@ These examples show typical uses of @code{error}: | |||
| 1100 | error symbol @code{error}, and a list containing the string returned by | 1100 | error symbol @code{error}, and a list containing the string returned by |
| 1101 | @code{format-message}. | 1101 | @code{format-message}. |
| 1102 | 1102 | ||
| 1103 | In a format string containing single quotes, curved quotes @t{‘like | 1103 | A format that quotes with grave accents and apostrophes @t{`like |
| 1104 | this’} and grave quotes @t{`like this'} work better than straight | 1104 | this'} typically generates curved quotes @t{‘like this’}. In |
| 1105 | quotes @t{'like this'}, as @code{error} typically formats every | 1105 | contrast, a format that quotes with only apostrophes @t{'like this'} |
| 1106 | straight quote as a curved closing quote. | 1106 | typically generates two closing curved quotes @t{’like this’}, an |
| 1107 | unusual style in English. @xref{Keys in Documentation}, for how the | ||
| 1108 | @code{text-quoting-style} variable affects generated quotes. | ||
| 1107 | 1109 | ||
| 1108 | @strong{Warning:} If you want to use your own string as an error message | 1110 | @strong{Warning:} If you want to use your own string as an error message |
| 1109 | verbatim, don't just write @code{(error @var{string})}. If @var{string} | 1111 | 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 c80f78c0e3b..b0cd8731fe2 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -265,10 +265,12 @@ 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 | In a format string containing single quotes, curved quotes @t{‘like | 268 | A format that quotes with grave accents and apostrophes @t{`like |
| 269 | this’} and grave quotes @t{`like this'} work better than straight | 269 | this'} typically generates curved quotes @t{‘like this’}. In |
| 270 | quotes @t{'like this'}, as @code{message} typically formats every | 270 | contrast, a format that quotes with only apostrophes @t{'like this'} |
| 271 | straight quote as a curved closing quote. | 271 | typically generates two closing curved quotes @t{’like this’}, an |
| 272 | unusual style in English. @xref{Keys in Documentation}, for how the | ||
| 273 | @code{text-quoting-style} variable affects generated quotes. | ||
| 272 | 274 | ||
| 273 | In batch mode, the message is printed to the standard error stream, | 275 | In batch mode, the message is printed to the standard error stream, |
| 274 | followed by a newline. | 276 | followed by a newline. |
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 58a11f29a4c..b945e438f55 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi | |||
| @@ -335,10 +335,14 @@ specifies @var{mapvar}'s value as the keymap for any following | |||
| 335 | @item ‘ | 335 | @item ‘ |
| 336 | @itemx ` | 336 | @itemx ` |
| 337 | (left single quotation mark and grave accent) both stand for a left quote. | 337 | (left single quotation mark and grave accent) both stand for a left quote. |
| 338 | This generates a left single quotation mark, an apostrophe, or a grave | ||
| 339 | accent depending on the value of @code{text-quoting-style}. | ||
| 338 | 340 | ||
| 339 | @item ’ | 341 | @item ’ |
| 340 | @itemx ' | 342 | @itemx ' |
| 341 | (right single quotation mark and apostrophe) both stand for a right quote. | 343 | (right single quotation mark and apostrophe) both stand for a right quote. |
| 344 | This generates a right single quotation mark or an apostrophe | ||
| 345 | depending on the value of @code{text-quoting-style}. | ||
| 342 | 346 | ||
| 343 | @item \= | 347 | @item \= |
| 344 | quotes the following character and is discarded; thus, @samp{\=`} puts | 348 | quotes the following character and is discarded; thus, @samp{\=`} puts |
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 9d6613c522c..c6563f7e03c 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -834,8 +834,14 @@ if any. | |||
| 834 | This function acts like @code{format}, except it also converts any | 834 | This function acts like @code{format}, except it also converts any |
| 835 | curved single quotes in @var{string} as per the value of | 835 | curved single quotes in @var{string} as per the value of |
| 836 | @code{text-quoting-style}, and treats grave accent (@t{`}) and | 836 | @code{text-quoting-style}, and treats grave accent (@t{`}) and |
| 837 | apostrophe (@t{'}) as if they were curved single quotes. @xref{Keys | 837 | apostrophe (@t{'}) as if they were curved single quotes. |
| 838 | in Documentation}. | 838 | |
| 839 | A format that quotes with grave accents and apostrophes @t{`like | ||
| 840 | this'} typically generates curved quotes @t{‘like this’}. In | ||
| 841 | contrast, a format that quotes with only apostrophes @t{'like this'} | ||
| 842 | typically generates two closing curved quotes @t{’like this’}, an | ||
| 843 | unusual style in English. @xref{Keys in Documentation}, for how the | ||
| 844 | @code{text-quoting-style} variable affects generated quotes. | ||
| 839 | @end defun | 845 | @end defun |
| 840 | 846 | ||
| 841 | @cindex @samp{%} in format | 847 | @cindex @samp{%} in format |
diff --git a/lisp/subr.el b/lisp/subr.el index 0f021701e9f..3ac61f9a45f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -290,21 +290,27 @@ This function accepts any number of arguments, but ignores them." | |||
| 290 | 290 | ||
| 291 | ;; Signal a compile-error if the first arg is missing. | 291 | ;; Signal a compile-error if the first arg is missing. |
| 292 | (defun error (&rest args) | 292 | (defun error (&rest args) |
| 293 | "Signal an error, making error message by passing all args to `format'. | 293 | "Signal an error, making a message by passing args to `format-message'. |
| 294 | In Emacs, the convention is that error messages start with a capital | 294 | In Emacs, the convention is that error messages start with a capital |
| 295 | letter but *do not* end with a period. Please follow this convention | 295 | letter but *do not* end with a period. Please follow this convention |
| 296 | for the sake of consistency." | 296 | for the sake of consistency. |
| 297 | |||
| 298 | Note: (error \"%s\" VALUE) makes the message VALUE without | ||
| 299 | interpreting format characters like `%', `\\=`', and `\\=''." | ||
| 297 | (declare (advertised-calling-convention (string &rest args) "23.1")) | 300 | (declare (advertised-calling-convention (string &rest args) "23.1")) |
| 298 | (signal 'error (list (apply #'format-message args)))) | 301 | (signal 'error (list (apply #'format-message args)))) |
| 299 | 302 | ||
| 300 | (defun user-error (format &rest args) | 303 | (defun user-error (format &rest args) |
| 301 | "Signal a pilot error, making error message by passing all args to `format'. | 304 | "Signal a pilot error, making a message by passing args to `format-message'. |
| 302 | In Emacs, the convention is that error messages start with a capital | 305 | In Emacs, the convention is that error messages start with a capital |
| 303 | letter but *do not* end with a period. Please follow this convention | 306 | letter but *do not* end with a period. Please follow this convention |
| 304 | for the sake of consistency. | 307 | for the sake of consistency. |
| 305 | This is just like `error' except that `user-error's are expected to be the | 308 | This is just like `error' except that `user-error's are expected to be the |
| 306 | result of an incorrect manipulation on the part of the user, rather than the | 309 | result of an incorrect manipulation on the part of the user, rather than the |
| 307 | result of an actual problem." | 310 | result of an actual problem. |
| 311 | |||
| 312 | Note: (user-error \"%s\" VALUE) makes the message VALUE without | ||
| 313 | interpreting format characters like `%', `\\=`', and `\\=''." | ||
| 308 | (signal 'user-error (list (apply #'format-message format args)))) | 314 | (signal 'user-error (list (apply #'format-message format args)))) |
| 309 | 315 | ||
| 310 | (defun define-error (name message &optional parent) | 316 | (defun define-error (name message &optional parent) |
diff --git a/src/callint.c b/src/callint.c index e56f7cd1b84..053ee6cdaa5 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -272,7 +272,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 272 | { | 272 | { |
| 273 | /* `args' will contain the array of arguments to pass to the function. | 273 | /* `args' will contain the array of arguments to pass to the function. |
| 274 | `visargs' will contain the same list but in a nicer form, so that if we | 274 | `visargs' will contain the same list but in a nicer form, so that if we |
| 275 | pass it to `Fformat' it will be understandable to a human. */ | 275 | pass it to `Fformat_message' it will be understandable to a human. */ |
| 276 | Lisp_Object *args, *visargs; | 276 | Lisp_Object *args, *visargs; |
| 277 | Lisp_Object specs; | 277 | Lisp_Object specs; |
| 278 | Lisp_Object filter_specs; | 278 | Lisp_Object filter_specs; |
diff --git a/src/doprnt.c b/src/doprnt.c index 506bbc3df35..9d8b783565f 100644 --- a/src/doprnt.c +++ b/src/doprnt.c | |||
| @@ -46,15 +46,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 46 | ignored %s and %c conversions. (See below for the detailed documentation of | 46 | ignored %s and %c conversions. (See below for the detailed documentation of |
| 47 | what is supported.) However, this is okay, as this function is supposed to | 47 | what is supported.) However, this is okay, as this function is supposed to |
| 48 | be called from `error' and similar functions, and thus does not need to | 48 | be called from `error' and similar functions, and thus does not need to |
| 49 | support features beyond those in `Fformat', which is used by `error' on the | 49 | support features beyond those in `Fformat_message', which is used |
| 50 | Lisp level. */ | 50 | by `error' on the Lisp level. */ |
| 51 | 51 | ||
| 52 | /* In the FORMAT argument this function supports ` and ' as directives | 52 | /* In the FORMAT argument this function supports ` and ' as directives |
| 53 | that output left and right quotes as per ‘text-quoting style’. It | 53 | that output left and right quotes as per ‘text-quoting style’. It |
| 54 | also supports the following %-sequences: | 54 | also supports the following %-sequences: |
| 55 | 55 | ||
| 56 | %s means print a string argument. | 56 | %s means print a string argument. |
| 57 | %S is silently treated as %s, for loose compatibility with `Fformat'. | 57 | %S is treated as %s, for loose compatibility with `Fformat_message'. |
| 58 | %d means print a `signed int' argument in decimal. | 58 | %d means print a `signed int' argument in decimal. |
| 59 | %o means print an `unsigned int' argument in octal. | 59 | %o means print an `unsigned int' argument in octal. |
| 60 | %x means print an `unsigned int' argument in hex. | 60 | %x means print an `unsigned int' argument in hex. |
diff --git a/src/editfns.c b/src/editfns.c index f0ce4e7cf34..a858e6e79dd 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3665,10 +3665,11 @@ In batch mode, the message is printed to the standard error stream, | |||
| 3665 | followed by a newline. | 3665 | followed by a newline. |
| 3666 | 3666 | ||
| 3667 | The first argument is a format control string, and the rest are data | 3667 | The first argument is a format control string, and the rest are data |
| 3668 | to be formatted under control of the string. See `format' for details. | 3668 | to be formatted under control of the string. See `format-message' for |
| 3669 | details. | ||
| 3669 | 3670 | ||
| 3670 | Note: Use (message "%s" VALUE) to print the value of expressions and | 3671 | Note: (message "%s" VALUE) displays the string VALUE without |
| 3671 | variables to avoid accidentally interpreting `%' as format specifiers. | 3672 | interpreting format characters like `%', `\\=`', and `\\=''. |
| 3672 | 3673 | ||
| 3673 | If the first argument is nil or the empty string, the function clears | 3674 | If the first argument is nil or the empty string, the function clears |
| 3674 | any existing message; this lets the minibuffer contents show. See | 3675 | any existing message; this lets the minibuffer contents show. See |
| @@ -3696,7 +3697,8 @@ DEFUN ("message-box", Fmessage_box, Smessage_box, 1, MANY, 0, | |||
| 3696 | doc: /* Display a message, in a dialog box if possible. | 3697 | doc: /* Display a message, in a dialog box if possible. |
| 3697 | If a dialog box is not available, use the echo area. | 3698 | If a dialog box is not available, use the echo area. |
| 3698 | The first argument is a format control string, and the rest are data | 3699 | The first argument is a format control string, and the rest are data |
| 3699 | to be formatted under control of the string. See `format' for details. | 3700 | to be formatted under control of the string. See `format-message' for |
| 3701 | details. | ||
| 3700 | 3702 | ||
| 3701 | If the first argument is nil or the empty string, clear any existing | 3703 | If the first argument is nil or the empty string, clear any existing |
| 3702 | message; let the minibuffer contents show. | 3704 | message; let the minibuffer contents show. |
| @@ -3727,7 +3729,8 @@ If this command was invoked with the mouse, use a dialog box if | |||
| 3727 | `use-dialog-box' is non-nil. | 3729 | `use-dialog-box' is non-nil. |
| 3728 | Otherwise, use the echo area. | 3730 | Otherwise, use the echo area. |
| 3729 | The first argument is a format control string, and the rest are data | 3731 | The first argument is a format control string, and the rest are data |
| 3730 | to be formatted under control of the string. See `format' for details. | 3732 | to be formatted under control of the string. See `format-message' for |
| 3733 | details. | ||
| 3731 | 3734 | ||
| 3732 | If the first argument is nil or the empty string, clear any existing | 3735 | If the first argument is nil or the empty string, clear any existing |
| 3733 | message; let the minibuffer contents show. | 3736 | message; let the minibuffer contents show. |