aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2016-05-03 08:02:16 -0700
committerPaul Eggert2016-05-03 08:03:04 -0700
commit2ea2a2f1a5b5b2e1b20f1ee8c86058334d0a2652 (patch)
tree0a7120c29c00676f6e8f3599227c2ecfc37b5e26
parent8544b9879c652e7c700652a4ba6fd17245163bd4 (diff)
downloademacs-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.texi4
-rw-r--r--doc/lispintro/emacs-lisp-intro.texi28
-rw-r--r--doc/lispref/control.texi10
-rw-r--r--doc/lispref/display.texi10
-rw-r--r--doc/lispref/help.texi4
-rw-r--r--doc/lispref/strings.texi10
-rw-r--r--lisp/subr.el14
-rw-r--r--src/callint.c2
-rw-r--r--src/doprnt.c6
-rw-r--r--src/editfns.c13
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
864you explicitly invoke them. It changes the syntax table so that 864you explicitly invoke them. It changes the syntax table so that
865single-quotes are considered part of words (e.g., @samp{don't} is 865apostrophes are considered part of words (e.g., @samp{don't} is
866considered one word). However, if a word starts with a single-quote, 866considered one word). However, if a word starts with an apostrophe,
867it is treated as a prefix for the purposes of capitalization 867it 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
869expected). 869expected).
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
1004claim is unwarranted. Lisp stands for LISt Processing, and the 1004claim is unwarranted. Lisp stands for LISt Processing, and the
1005programming language handles @emph{lists} (and lists of lists) by 1005programming language handles @emph{lists} (and lists of lists) by
1006putting them between parentheses. The parentheses mark the boundaries 1006putting them between parentheses. The parentheses mark the boundaries
1007of the list. Sometimes a list is preceded by a single apostrophe or 1007of the list. Sometimes a list is preceded by an apostrophe @samp{'},
1008quotation mark, @samp{'}@footnote{The single apostrophe or quotation 1008called a @dfn{single-quote} in Lisp.@footnote{A single-quote is an
1009mark is an abbreviation for the function @code{quote}; you need not 1009abbreviation for the special form @code{quote}; you need not think
1010think about functions now; functions are defined in @ref{Making 1010about special forms now. @xref{Complications}.} Lists are the basis
1011Errors, , Generate an Error Message}.} Lists are the basis of Lisp. 1011of 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.
2490Then the instructions in the function definition are carried out. 2490Then the instructions in the function definition are carried out.
2491 2491
2492@item 2492@item
2493A single quotation mark, 2493A 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
2501return the following expression as written, and not evaluate it as it 2494return the following expression as written, and not evaluate it as it
2502would if the quote were not there. 2495would if the quote were not there.
2503 2496
@@ -7610,7 +7603,8 @@ displays in which grave accent and apostrophe were often mirror images
7610suitable for use as quotes. On most modern displays this is no longer 7603suitable for use as quotes. On most modern displays this is no longer
7611true, and when these two ASCII characters appear in documentation 7604true, and when these two ASCII characters appear in documentation
7612strings or diagnostic message formats, Emacs typically transliterates 7605strings or diagnostic message formats, Emacs typically transliterates
7613them to curved single quotes, so that the abovequoted symbol appears 7606them to @dfn{curved quotes} (left and right single quotation marks),
7607so that the abovequoted symbol appears
7614as @t{‘case-fold-search’}. Source-code strings can also simply use 7608as @t{‘case-fold-search’}. Source-code strings can also simply use
7615curved quotes directly. 7609curved quotes directly.
7616 7610
@@ -17117,7 +17111,7 @@ This line is a short, but complete Emacs Lisp expression.
17117 17111
17118We are already familiar with @code{setq}. It sets the following variable, 17112We 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}.
17120The single quote mark before @code{text-mode} tells Emacs to deal directly 17114The single-quote before @code{text-mode} tells Emacs to deal directly
17121with the @code{text-mode} symbol, not with whatever it might stand for. 17115with 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},
17123for a reminder of how @code{setq} works. 17117for a reminder of how @code{setq} works.
@@ -17284,11 +17278,11 @@ Rebinding Keys in Your Init File, emacs, The GNU Emacs Manual}, for
17284details.) 17278details.)
17285 17279
17286The command invoked by the keys is @code{compare-windows}. Note that 17280The 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
17288would first try to evaluate the symbol to determine its value. 17282would first try to evaluate the symbol to determine its value.
17289 17283
17290These three things, the double quotation marks, the backslash before 17284These three things, the double quotation marks, the backslash before
17291the @samp{C}, and the single quote mark are necessary parts of 17285the @samp{C}, and the single-quote are necessary parts of
17292keybinding that I tend to forget. Fortunately, I have come to 17286keybinding that I tend to forget. Fortunately, I have come to
17293remember that I should look at my existing @file{.emacs} file, and 17287remember that I should look at my existing @file{.emacs} file, and
17294adapt what is there. 17288adapt 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}:
1100error symbol @code{error}, and a list containing the string returned by 1100error symbol @code{error}, and a list containing the string returned by
1101@code{format-message}. 1101@code{format-message}.
1102 1102
1103In a format string containing single quotes, curved quotes @t{‘like 1103A format that quotes with grave accents and apostrophes @t{`like
1104this’} and grave quotes @t{`like this'} work better than straight 1104this'} typically generates curved quotes @t{‘like this’}. In
1105quotes @t{'like this'}, as @code{error} typically formats every 1105contrast, a format that quotes with only apostrophes @t{'like this'}
1106straight quote as a curved closing quote. 1106typically generates two closing curved quotes @t{’like this’}, an
1107unusual 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
1109verbatim, don't just write @code{(error @var{string})}. If @var{string} 1111verbatim, 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}).
265The string is also added to the @file{*Messages*} buffer, but without 265The string is also added to the @file{*Messages*} buffer, but without
266text properties (@pxref{Logging Messages}). 266text properties (@pxref{Logging Messages}).
267 267
268In a format string containing single quotes, curved quotes @t{‘like 268A format that quotes with grave accents and apostrophes @t{`like
269this’} and grave quotes @t{`like this'} work better than straight 269this'} typically generates curved quotes @t{‘like this’}. In
270quotes @t{'like this'}, as @code{message} typically formats every 270contrast, a format that quotes with only apostrophes @t{'like this'}
271straight quote as a curved closing quote. 271typically generates two closing curved quotes @t{’like this’}, an
272unusual style in English. @xref{Keys in Documentation}, for how the
273@code{text-quoting-style} variable affects generated quotes.
272 274
273In batch mode, the message is printed to the standard error stream, 275In batch mode, the message is printed to the standard error stream,
274followed by a newline. 276followed 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.
338This generates a left single quotation mark, an apostrophe, or a grave
339accent 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.
344This generates a right single quotation mark or an apostrophe
345depending on the value of @code{text-quoting-style}.
342 346
343@item \= 347@item \=
344quotes the following character and is discarded; thus, @samp{\=`} puts 348quotes 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.
834This function acts like @code{format}, except it also converts any 834This function acts like @code{format}, except it also converts any
835curved single quotes in @var{string} as per the value of 835curved 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
837apostrophe (@t{'}) as if they were curved single quotes. @xref{Keys 837apostrophe (@t{'}) as if they were curved single quotes.
838in Documentation}. 838
839A format that quotes with grave accents and apostrophes @t{`like
840this'} typically generates curved quotes @t{‘like this’}. In
841contrast, a format that quotes with only apostrophes @t{'like this'}
842typically generates two closing curved quotes @t{’like this’}, an
843unusual 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'.
294In Emacs, the convention is that error messages start with a capital 294In Emacs, the convention is that error messages start with a capital
295letter but *do not* end with a period. Please follow this convention 295letter but *do not* end with a period. Please follow this convention
296for the sake of consistency." 296for the sake of consistency.
297
298Note: (error \"%s\" VALUE) makes the message VALUE without
299interpreting 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'.
302In Emacs, the convention is that error messages start with a capital 305In Emacs, the convention is that error messages start with a capital
303letter but *do not* end with a period. Please follow this convention 306letter but *do not* end with a period. Please follow this convention
304for the sake of consistency. 307for the sake of consistency.
305This is just like `error' except that `user-error's are expected to be the 308This is just like `error' except that `user-error's are expected to be the
306result of an incorrect manipulation on the part of the user, rather than the 309result of an incorrect manipulation on the part of the user, rather than the
307result of an actual problem." 310result of an actual problem.
311
312Note: (user-error \"%s\" VALUE) makes the message VALUE without
313interpreting 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,
3665followed by a newline. 3665followed by a newline.
3666 3666
3667The first argument is a format control string, and the rest are data 3667The first argument is a format control string, and the rest are data
3668to be formatted under control of the string. See `format' for details. 3668to be formatted under control of the string. See `format-message' for
3669details.
3669 3670
3670Note: Use (message "%s" VALUE) to print the value of expressions and 3671Note: (message "%s" VALUE) displays the string VALUE without
3671variables to avoid accidentally interpreting `%' as format specifiers. 3672interpreting format characters like `%', `\\=`', and `\\=''.
3672 3673
3673If the first argument is nil or the empty string, the function clears 3674If the first argument is nil or the empty string, the function clears
3674any existing message; this lets the minibuffer contents show. See 3675any 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.
3697If a dialog box is not available, use the echo area. 3698If a dialog box is not available, use the echo area.
3698The first argument is a format control string, and the rest are data 3699The first argument is a format control string, and the rest are data
3699to be formatted under control of the string. See `format' for details. 3700to be formatted under control of the string. See `format-message' for
3701details.
3700 3702
3701If the first argument is nil or the empty string, clear any existing 3703If the first argument is nil or the empty string, clear any existing
3702message; let the minibuffer contents show. 3704message; 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.
3728Otherwise, use the echo area. 3730Otherwise, use the echo area.
3729The first argument is a format control string, and the rest are data 3731The first argument is a format control string, and the rest are data
3730to be formatted under control of the string. See `format' for details. 3732to be formatted under control of the string. See `format-message' for
3733details.
3731 3734
3732If the first argument is nil or the empty string, clear any existing 3735If the first argument is nil or the empty string, clear any existing
3733message; let the minibuffer contents show. 3736message; let the minibuffer contents show.