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).
This commit is contained in:
parent
8544b9879c
commit
2ea2a2f1a5
10 changed files with 59 additions and 42 deletions
|
@ -862,8 +862,8 @@ indenting the current line. @xref{Indentation}, for details.
|
||||||
|
|
||||||
Text mode turns off the features concerned with comments except when
|
Text mode turns off the features concerned with comments except when
|
||||||
you explicitly invoke them. It changes the syntax table so that
|
you explicitly invoke them. It changes the syntax table so that
|
||||||
single-quotes are considered part of words (e.g., @samp{don't} is
|
apostrophes are considered part of words (e.g., @samp{don't} is
|
||||||
considered one word). However, if a word starts with a single-quote,
|
considered one word). However, if a word starts with an apostrophe,
|
||||||
it is treated as a prefix for the purposes of capitalization
|
it is treated as a prefix for the purposes of capitalization
|
||||||
(e.g., @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as
|
(e.g., @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as
|
||||||
expected).
|
expected).
|
||||||
|
|
|
@ -1004,11 +1004,11 @@ the name stands for ``Lots of Isolated Silly Parentheses''. But the
|
||||||
claim is unwarranted. Lisp stands for LISt Processing, and the
|
claim is unwarranted. Lisp stands for LISt Processing, and the
|
||||||
programming language handles @emph{lists} (and lists of lists) by
|
programming language handles @emph{lists} (and lists of lists) by
|
||||||
putting them between parentheses. The parentheses mark the boundaries
|
putting them between parentheses. The parentheses mark the boundaries
|
||||||
of the list. Sometimes a list is preceded by a single apostrophe or
|
of the list. Sometimes a list is preceded by an apostrophe @samp{'},
|
||||||
quotation mark, @samp{'}@footnote{The single apostrophe or quotation
|
called a @dfn{single-quote} in Lisp.@footnote{A single-quote is an
|
||||||
mark is an abbreviation for the function @code{quote}; you need not
|
abbreviation for the special form @code{quote}; you need not think
|
||||||
think about functions now; functions are defined in @ref{Making
|
about special forms now. @xref{Complications}.} Lists are the basis
|
||||||
Errors, , Generate an Error Message}.} Lists are the basis of Lisp.
|
of Lisp.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Lisp Lists:: What are lists?
|
* Lisp Lists:: What are lists?
|
||||||
|
@ -2490,14 +2490,7 @@ in the list and then at the function definition bound to that symbol.
|
||||||
Then the instructions in the function definition are carried out.
|
Then the instructions in the function definition are carried out.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
A single quotation mark,
|
A single-quote @samp{'} tells the Lisp interpreter that it should
|
||||||
@ifinfo
|
|
||||||
'
|
|
||||||
@end ifinfo
|
|
||||||
@ifnotinfo
|
|
||||||
@code{'}
|
|
||||||
@end ifnotinfo
|
|
||||||
, tells the Lisp interpreter that it should
|
|
||||||
return the following expression as written, and not evaluate it as it
|
return the following expression as written, and not evaluate it as it
|
||||||
would if the quote were not there.
|
would if the quote were not there.
|
||||||
|
|
||||||
|
@ -7610,7 +7603,8 @@ displays in which grave accent and apostrophe were often mirror images
|
||||||
suitable for use as quotes. On most modern displays this is no longer
|
suitable for use as quotes. On most modern displays this is no longer
|
||||||
true, and when these two ASCII characters appear in documentation
|
true, and when these two ASCII characters appear in documentation
|
||||||
strings or diagnostic message formats, Emacs typically transliterates
|
strings or diagnostic message formats, Emacs typically transliterates
|
||||||
them to curved single quotes, so that the abovequoted symbol appears
|
them to @dfn{curved quotes} (left and right single quotation marks),
|
||||||
|
so that the abovequoted symbol appears
|
||||||
as @t{‘case-fold-search’}. Source-code strings can also simply use
|
as @t{‘case-fold-search’}. Source-code strings can also simply use
|
||||||
curved quotes directly.
|
curved quotes directly.
|
||||||
|
|
||||||
|
@ -17117,7 +17111,7 @@ This line is a short, but complete Emacs Lisp expression.
|
||||||
|
|
||||||
We are already familiar with @code{setq}. It sets the following variable,
|
We are already familiar with @code{setq}. It sets the following variable,
|
||||||
@code{major-mode}, to the subsequent value, which is @code{text-mode}.
|
@code{major-mode}, to the subsequent value, which is @code{text-mode}.
|
||||||
The single quote mark before @code{text-mode} tells Emacs to deal directly
|
The single-quote before @code{text-mode} tells Emacs to deal directly
|
||||||
with the @code{text-mode} symbol, not with whatever it might stand for.
|
with the @code{text-mode} symbol, not with whatever it might stand for.
|
||||||
@xref{set & setq, , Setting the Value of a Variable},
|
@xref{set & setq, , Setting the Value of a Variable},
|
||||||
for a reminder of how @code{setq} works.
|
for a reminder of how @code{setq} works.
|
||||||
|
@ -17284,11 +17278,11 @@ Rebinding Keys in Your Init File, emacs, The GNU Emacs Manual}, for
|
||||||
details.)
|
details.)
|
||||||
|
|
||||||
The command invoked by the keys is @code{compare-windows}. Note that
|
The command invoked by the keys is @code{compare-windows}. Note that
|
||||||
@code{compare-windows} is preceded by a single quote; otherwise, Emacs
|
@code{compare-windows} is preceded by a single-quote; otherwise, Emacs
|
||||||
would first try to evaluate the symbol to determine its value.
|
would first try to evaluate the symbol to determine its value.
|
||||||
|
|
||||||
These three things, the double quotation marks, the backslash before
|
These three things, the double quotation marks, the backslash before
|
||||||
the @samp{C}, and the single quote mark are necessary parts of
|
the @samp{C}, and the single-quote are necessary parts of
|
||||||
keybinding that I tend to forget. Fortunately, I have come to
|
keybinding that I tend to forget. Fortunately, I have come to
|
||||||
remember that I should look at my existing @file{.emacs} file, and
|
remember that I should look at my existing @file{.emacs} file, and
|
||||||
adapt what is there.
|
adapt what is there.
|
||||||
|
|
|
@ -1100,10 +1100,12 @@ These examples show typical uses of @code{error}:
|
||||||
error symbol @code{error}, and a list containing the string returned by
|
error symbol @code{error}, and a list containing the string returned by
|
||||||
@code{format-message}.
|
@code{format-message}.
|
||||||
|
|
||||||
In a format string containing single quotes, curved quotes @t{‘like
|
A format that quotes with grave accents and apostrophes @t{`like
|
||||||
this’} and grave quotes @t{`like this'} work better than straight
|
this'} typically generates curved quotes @t{‘like this’}. In
|
||||||
quotes @t{'like this'}, as @code{error} typically formats every
|
contrast, a format that quotes with only apostrophes @t{'like this'}
|
||||||
straight quote as a curved closing quote.
|
typically generates two closing curved quotes @t{’like this’}, an
|
||||||
|
unusual style in English. @xref{Keys in Documentation}, for how the
|
||||||
|
@code{text-quoting-style} variable affects generated quotes.
|
||||||
|
|
||||||
@strong{Warning:} If you want to use your own string as an error message
|
@strong{Warning:} If you want to use your own string as an error message
|
||||||
verbatim, don't just write @code{(error @var{string})}. If @var{string}
|
verbatim, don't just write @code{(error @var{string})}. If @var{string}
|
||||||
|
|
|
@ -265,10 +265,12 @@ properties, it is displayed with the specified faces (@pxref{Faces}).
|
||||||
The string is also added to the @file{*Messages*} buffer, but without
|
The string is also added to the @file{*Messages*} buffer, but without
|
||||||
text properties (@pxref{Logging Messages}).
|
text properties (@pxref{Logging Messages}).
|
||||||
|
|
||||||
In a format string containing single quotes, curved quotes @t{‘like
|
A format that quotes with grave accents and apostrophes @t{`like
|
||||||
this’} and grave quotes @t{`like this'} work better than straight
|
this'} typically generates curved quotes @t{‘like this’}. In
|
||||||
quotes @t{'like this'}, as @code{message} typically formats every
|
contrast, a format that quotes with only apostrophes @t{'like this'}
|
||||||
straight quote as a curved closing quote.
|
typically generates two closing curved quotes @t{’like this’}, an
|
||||||
|
unusual style in English. @xref{Keys in Documentation}, for how the
|
||||||
|
@code{text-quoting-style} variable affects generated quotes.
|
||||||
|
|
||||||
In batch mode, the message is printed to the standard error stream,
|
In batch mode, the message is printed to the standard error stream,
|
||||||
followed by a newline.
|
followed by a newline.
|
||||||
|
|
|
@ -335,10 +335,14 @@ specifies @var{mapvar}'s value as the keymap for any following
|
||||||
@item ‘
|
@item ‘
|
||||||
@itemx `
|
@itemx `
|
||||||
(left single quotation mark and grave accent) both stand for a left quote.
|
(left single quotation mark and grave accent) both stand for a left quote.
|
||||||
|
This generates a left single quotation mark, an apostrophe, or a grave
|
||||||
|
accent depending on the value of @code{text-quoting-style}.
|
||||||
|
|
||||||
@item ’
|
@item ’
|
||||||
@itemx '
|
@itemx '
|
||||||
(right single quotation mark and apostrophe) both stand for a right quote.
|
(right single quotation mark and apostrophe) both stand for a right quote.
|
||||||
|
This generates a right single quotation mark or an apostrophe
|
||||||
|
depending on the value of @code{text-quoting-style}.
|
||||||
|
|
||||||
@item \=
|
@item \=
|
||||||
quotes the following character and is discarded; thus, @samp{\=`} puts
|
quotes the following character and is discarded; thus, @samp{\=`} puts
|
||||||
|
|
|
@ -834,8 +834,14 @@ if any.
|
||||||
This function acts like @code{format}, except it also converts any
|
This function acts like @code{format}, except it also converts any
|
||||||
curved single quotes in @var{string} as per the value of
|
curved single quotes in @var{string} as per the value of
|
||||||
@code{text-quoting-style}, and treats grave accent (@t{`}) and
|
@code{text-quoting-style}, and treats grave accent (@t{`}) and
|
||||||
apostrophe (@t{'}) as if they were curved single quotes. @xref{Keys
|
apostrophe (@t{'}) as if they were curved single quotes.
|
||||||
in Documentation}.
|
|
||||||
|
A format that quotes with grave accents and apostrophes @t{`like
|
||||||
|
this'} typically generates curved quotes @t{‘like this’}. In
|
||||||
|
contrast, a format that quotes with only apostrophes @t{'like this'}
|
||||||
|
typically generates two closing curved quotes @t{’like this’}, an
|
||||||
|
unusual style in English. @xref{Keys in Documentation}, for how the
|
||||||
|
@code{text-quoting-style} variable affects generated quotes.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@cindex @samp{%} in format
|
@cindex @samp{%} in format
|
||||||
|
|
14
lisp/subr.el
14
lisp/subr.el
|
@ -290,21 +290,27 @@ This function accepts any number of arguments, but ignores them."
|
||||||
|
|
||||||
;; Signal a compile-error if the first arg is missing.
|
;; Signal a compile-error if the first arg is missing.
|
||||||
(defun error (&rest args)
|
(defun error (&rest args)
|
||||||
"Signal an error, making error message by passing all args to `format'.
|
"Signal an error, making a message by passing args to `format-message'.
|
||||||
In Emacs, the convention is that error messages start with a capital
|
In Emacs, the convention is that error messages start with a capital
|
||||||
letter but *do not* end with a period. Please follow this convention
|
letter but *do not* end with a period. Please follow this convention
|
||||||
for the sake of consistency."
|
for the sake of consistency.
|
||||||
|
|
||||||
|
Note: (error \"%s\" VALUE) makes the message VALUE without
|
||||||
|
interpreting format characters like `%', `\\=`', and `\\=''."
|
||||||
(declare (advertised-calling-convention (string &rest args) "23.1"))
|
(declare (advertised-calling-convention (string &rest args) "23.1"))
|
||||||
(signal 'error (list (apply #'format-message args))))
|
(signal 'error (list (apply #'format-message args))))
|
||||||
|
|
||||||
(defun user-error (format &rest args)
|
(defun user-error (format &rest args)
|
||||||
"Signal a pilot error, making error message by passing all args to `format'.
|
"Signal a pilot error, making a message by passing args to `format-message'.
|
||||||
In Emacs, the convention is that error messages start with a capital
|
In Emacs, the convention is that error messages start with a capital
|
||||||
letter but *do not* end with a period. Please follow this convention
|
letter but *do not* end with a period. Please follow this convention
|
||||||
for the sake of consistency.
|
for the sake of consistency.
|
||||||
This is just like `error' except that `user-error's are expected to be the
|
This is just like `error' except that `user-error's are expected to be the
|
||||||
result of an incorrect manipulation on the part of the user, rather than the
|
result of an incorrect manipulation on the part of the user, rather than the
|
||||||
result of an actual problem."
|
result of an actual problem.
|
||||||
|
|
||||||
|
Note: (user-error \"%s\" VALUE) makes the message VALUE without
|
||||||
|
interpreting format characters like `%', `\\=`', and `\\=''."
|
||||||
(signal 'user-error (list (apply #'format-message format args))))
|
(signal 'user-error (list (apply #'format-message format args))))
|
||||||
|
|
||||||
(defun define-error (name message &optional parent)
|
(defun define-error (name message &optional parent)
|
||||||
|
|
|
@ -272,7 +272,7 @@ invoke it. If KEYS is omitted or nil, the return value of
|
||||||
{
|
{
|
||||||
/* `args' will contain the array of arguments to pass to the function.
|
/* `args' will contain the array of arguments to pass to the function.
|
||||||
`visargs' will contain the same list but in a nicer form, so that if we
|
`visargs' will contain the same list but in a nicer form, so that if we
|
||||||
pass it to `Fformat' it will be understandable to a human. */
|
pass it to `Fformat_message' it will be understandable to a human. */
|
||||||
Lisp_Object *args, *visargs;
|
Lisp_Object *args, *visargs;
|
||||||
Lisp_Object specs;
|
Lisp_Object specs;
|
||||||
Lisp_Object filter_specs;
|
Lisp_Object filter_specs;
|
||||||
|
|
|
@ -46,15 +46,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
ignored %s and %c conversions. (See below for the detailed documentation of
|
ignored %s and %c conversions. (See below for the detailed documentation of
|
||||||
what is supported.) However, this is okay, as this function is supposed to
|
what is supported.) However, this is okay, as this function is supposed to
|
||||||
be called from `error' and similar functions, and thus does not need to
|
be called from `error' and similar functions, and thus does not need to
|
||||||
support features beyond those in `Fformat', which is used by `error' on the
|
support features beyond those in `Fformat_message', which is used
|
||||||
Lisp level. */
|
by `error' on the Lisp level. */
|
||||||
|
|
||||||
/* In the FORMAT argument this function supports ` and ' as directives
|
/* In the FORMAT argument this function supports ` and ' as directives
|
||||||
that output left and right quotes as per ‘text-quoting style’. It
|
that output left and right quotes as per ‘text-quoting style’. It
|
||||||
also supports the following %-sequences:
|
also supports the following %-sequences:
|
||||||
|
|
||||||
%s means print a string argument.
|
%s means print a string argument.
|
||||||
%S is silently treated as %s, for loose compatibility with `Fformat'.
|
%S is treated as %s, for loose compatibility with `Fformat_message'.
|
||||||
%d means print a `signed int' argument in decimal.
|
%d means print a `signed int' argument in decimal.
|
||||||
%o means print an `unsigned int' argument in octal.
|
%o means print an `unsigned int' argument in octal.
|
||||||
%x means print an `unsigned int' argument in hex.
|
%x means print an `unsigned int' argument in hex.
|
||||||
|
|
|
@ -3665,10 +3665,11 @@ In batch mode, the message is printed to the standard error stream,
|
||||||
followed by a newline.
|
followed by a newline.
|
||||||
|
|
||||||
The first argument is a format control string, and the rest are data
|
The first argument is a format control string, and the rest are data
|
||||||
to be formatted under control of the string. See `format' for details.
|
to be formatted under control of the string. See `format-message' for
|
||||||
|
details.
|
||||||
|
|
||||||
Note: Use (message "%s" VALUE) to print the value of expressions and
|
Note: (message "%s" VALUE) displays the string VALUE without
|
||||||
variables to avoid accidentally interpreting `%' as format specifiers.
|
interpreting format characters like `%', `\\=`', and `\\=''.
|
||||||
|
|
||||||
If the first argument is nil or the empty string, the function clears
|
If the first argument is nil or the empty string, the function clears
|
||||||
any existing message; this lets the minibuffer contents show. See
|
any existing message; this lets the minibuffer contents show. See
|
||||||
|
@ -3696,7 +3697,8 @@ DEFUN ("message-box", Fmessage_box, Smessage_box, 1, MANY, 0,
|
||||||
doc: /* Display a message, in a dialog box if possible.
|
doc: /* Display a message, in a dialog box if possible.
|
||||||
If a dialog box is not available, use the echo area.
|
If a dialog box is not available, use the echo area.
|
||||||
The first argument is a format control string, and the rest are data
|
The first argument is a format control string, and the rest are data
|
||||||
to be formatted under control of the string. See `format' for details.
|
to be formatted under control of the string. See `format-message' for
|
||||||
|
details.
|
||||||
|
|
||||||
If the first argument is nil or the empty string, clear any existing
|
If the first argument is nil or the empty string, clear any existing
|
||||||
message; let the minibuffer contents show.
|
message; let the minibuffer contents show.
|
||||||
|
@ -3727,7 +3729,8 @@ If this command was invoked with the mouse, use a dialog box if
|
||||||
`use-dialog-box' is non-nil.
|
`use-dialog-box' is non-nil.
|
||||||
Otherwise, use the echo area.
|
Otherwise, use the echo area.
|
||||||
The first argument is a format control string, and the rest are data
|
The first argument is a format control string, and the rest are data
|
||||||
to be formatted under control of the string. See `format' for details.
|
to be formatted under control of the string. See `format-message' for
|
||||||
|
details.
|
||||||
|
|
||||||
If the first argument is nil or the empty string, clear any existing
|
If the first argument is nil or the empty string, clear any existing
|
||||||
message; let the minibuffer contents show.
|
message; let the minibuffer contents show.
|
||||||
|
|
Loading…
Add table
Reference in a new issue