[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Backslash-escaped brackets in string literals
From: |
Mattias Engdegård |
Subject: |
Backslash-escaped brackets in string literals |
Date: |
Fri, 24 Jan 2020 16:12:51 +0100 |
The manual contains the advice:
• If a line in a documentation string begins with an
open-parenthesis, write a backslash before the open-parenthesis,
like this:
The argument FOO can be either a number
\(a buffer position) or a string (a file name).
This prevents the open-parenthesis from being treated as the start
of a defun (*note Defuns: (emacs)Defuns.).
First of all, is this still true? I rarely bother escaping brackets in doc
strings and it doesn't seem to cause any editing confusion. For example,
beginning-of-defun doesn't seem to be fooled by a '(' in column 1 inside a doc
string.
(I do escape the (fn ...) annotation, probably out of superstition.)
Moreover, these backslashes appear a bit everywhere (not just doc strings), not
only at bol, and not only before an opening bracket. They make reading and
editing the text a bit more difficult. More importantly, they are a constant
source of potential mistakes, especially in regexps.
I have a tool to scan for all of them (using the help-echo annotation by
emacs-lisp-mode), but it would be much more useful if we were to remove all
existing occurrences. A list of all red backslashes attached.
miscape.log
Description: Binary data
- Backslash-escaped brackets in string literals,
Mattias Engdegård <=
- Re: Backslash-escaped brackets in string literals, Eli Zaretskii, 2020/01/24
- Re: Backslash-escaped brackets in string literals, Stefan Monnier, 2020/01/24
- Re: Backslash-escaped brackets in string literals, Mattias Engdegård, 2020/01/24
- Re: Backslash-escaped brackets in string literals, Eli Zaretskii, 2020/01/25
- Re: Backslash-escaped brackets in string literals, Mattias Engdegård, 2020/01/25
- Re: Backslash-escaped brackets in string literals, Eli Zaretskii, 2020/01/25
- Re: Backslash-escaped brackets in string literals, Mattias Engdegård, 2020/01/25
- Re: Backslash-escaped brackets in string literals, Eli Zaretskii, 2020/01/25
- Re: Backslash-escaped brackets in string literals, Mattias Engdegård, 2020/01/26
- Re: Backslash-escaped brackets in string literals, Eli Zaretskii, 2020/01/26