aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2020-01-25 16:16:37 +0100
committerMattias EngdegÄrd2020-01-26 14:52:15 +0100
commit2e9a153b26da820da5b731261ed9ca437c0212a3 (patch)
tree9e272582a13d2e077e129efb7288ad2ea16be228
parentd7cd4ab7d948427104003f1d35cf52a4eac45d0a (diff)
downloademacs-2e9a153b26da820da5b731261ed9ca437c0212a3.tar.gz
emacs-2e9a153b26da820da5b731261ed9ca437c0212a3.zip
Moderate recommendation to escape '(' in doc strings
Thanks to 57e2ca5c50 and related changes, opening brackets at the leftmost column inside doc strings are no longer mistaken for the start of a defun. * doc/lispref/tips.texi (Documentation Tips): Clarify recommendation and move it down the list. * etc/NEWS: Announce.
-rw-r--r--doc/lispref/tips.texi27
-rw-r--r--etc/NEWS4
2 files changed, 19 insertions, 12 deletions
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index 4395069fe24..0610f8029df 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -803,18 +803,6 @@ starting the sentence with lower-case ``t'', which could be somewhat
803distracting. 803distracting.
804 804
805@item 805@item
806If a line in a documentation string begins with an open-parenthesis,
807write a backslash before the open-parenthesis, like this:
808
809@example
810The argument FOO can be either a number
811\(a buffer position) or a string (a file name).
812@end example
813
814This prevents the open-parenthesis from being treated as the start of a
815defun (@pxref{Defuns,, Defuns, emacs, The GNU Emacs Manual}).
816
817@item
818Write documentation strings in the active voice, not the passive, and in 806Write documentation strings in the active voice, not the passive, and in
819the present tense, not the future. For instance, use ``Return a list 807the present tense, not the future. For instance, use ``Return a list
820containing A and B.@:'' instead of ``A list containing A and B will be 808containing A and B.@:'' instead of ``A list containing A and B will be
@@ -849,6 +837,21 @@ The documentation string for a variable that is a yes-or-no flag should
849start with words such as ``Non-nil means'', to make it clear that 837start with words such as ``Non-nil means'', to make it clear that
850all non-@code{nil} values are equivalent and indicate explicitly what 838all non-@code{nil} values are equivalent and indicate explicitly what
851@code{nil} and non-@code{nil} mean. 839@code{nil} and non-@code{nil} mean.
840
841@item
842If a line in a documentation string begins with an open-parenthesis,
843consider writing a backslash before the open-parenthesis, like this:
844
845@example
846The argument FOO can be either a number
847\(a buffer position) or a string (a file name).
848@end example
849
850This avoids a bug in Emacs versions older than 27.1, where the
851@samp{(} was treated as the start of a defun
852(@pxref{Defuns,, Defuns, emacs, The GNU Emacs Manual}).
853If you do not anticipate anyone editing your code with older Emacs
854versions, there is no need for this work-around.
852@end itemize 855@end itemize
853 856
854@node Comment Tips 857@node Comment Tips
diff --git a/etc/NEWS b/etc/NEWS
index 792851e5af5..433f1f76b80 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3338,6 +3338,10 @@ versions.
3338'forward-comment', 'scan-sexps', and 'forward-sexp' when parsing backward. 3338'forward-comment', 'scan-sexps', and 'forward-sexp' when parsing backward.
3339The new variable 'comment-use-syntax-ppss' can be set to nil to recover 3339The new variable 'comment-use-syntax-ppss' can be set to nil to recover
3340the old behavior if needed. 3340the old behavior if needed.
3341This also means that there is no longer any need to precede opening
3342brackets at the start of a line inside documentation strings with a
3343backslash, although there is no harm in doing so to make the code
3344easier to edit with an older Emacs version.
3341 3345
3342--- 3346---
3343** The 'server-name' and 'server-socket-dir' variables are set when a 3347** The 'server-name' and 'server-socket-dir' variables are set when a