unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Backslash-escaped brackets in string literals
@ 2020-01-24 15:12 Mattias Engdegård
  2020-01-24 15:39 ` Eli Zaretskii
  2020-01-24 17:36 ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Mattias Engdegård @ 2020-01-24 15:12 UTC (permalink / raw)
  To: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

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.


[-- Attachment #2: miscape.log --]
[-- Type: application/octet-stream, Size: 13421 bytes --]

-*- compilation -*-

lisp/registry.el:224:65: Ineffective string escape `\('
lisp/registry.el:226:58: Ineffective string escape `\('
lisp/registry.el:328:49: Ineffective string escape `\('
lisp/subr.el:3937:66: Ineffective string escape `\('
lisp/subr.el:4027:36: Ineffective string escape `\('
lisp/subr.el:4035:16: Ineffective string escape `\('
lisp/subr.el:4037:58: Ineffective string escape `\('
lisp/gnus/gnus-registry.el:244:26: Ineffective string escape `\('
lisp/gnus/gnus-registry.el:244:36: Ineffective string escape `\('
lisp/gnus/nntp.el:140:4: Ineffective string escape `\('
lisp/gnus/message.el:372:10: Ineffective string escape `\('
lisp/gnus/gnus-art.el:5943:44: Ineffective string escape `\('
lisp/gnus/gnus.el:2256:55: Ineffective string escape `\('
lisp/gnus/gnus-group.el:444:39: Ineffective string escape `\('
lisp/gnus/spam-stat.el:450:39: Ineffective string escape `\('
lisp/gnus/spam-stat.el:487:49: Ineffective string escape `\('
lisp/gnus/gnus-bookmark.el:121:22: Ineffective string escape `\('
lisp/gnus/gnus-bookmark.el:134:22: Ineffective string escape `\('
lisp/gnus/gnus-bookmark.el:795:55: Ineffective string escape `\('
lisp/foldout.el:249:23: Ineffective string escape `\('
lisp/net/tramp.el:117:13: Ineffective string escape `\('
lisp/net/tramp.el:491:39: Ineffective string escape `\('
lisp/net/tramp.el:1097:11: Ineffective string escape `\('
lisp/net/tramp.el:1172:31: Ineffective string escape `\('
lisp/net/dbus.el:1153:19: Ineffective string escape `\('
lisp/net/quickurl.el:209:3: Ineffective string escape `\('
lisp/net/nsm.el:374:37: Ineffective string escape `\#'
lisp/net/nsm.el:471:43: Ineffective string escape `\#'
lisp/net/nsm.el:606:63: Ineffective string escape `\#'
lisp/net/sasl-digest.el:57:38: Ineffective string escape `\('
lisp/net/ange-ftp.el:659:28: Ineffective string escape `\('
lisp/net/zeroconf.el:197:3: Ineffective string escape `\('
lisp/net/gnutls.el:128:12: Ineffective string escape `\('
lisp/eshell/esh-util.el:231:28: Ineffective string escape `\('
lisp/htmlfontify.el:1158:45: Ineffective string escape `\('
lisp/htmlfontify.el:1615:33: Ineffective string escape `\('
lisp/htmlfontify.el:1644:33: Ineffective string escape `\('
lisp/obsolete/iswitchb.el:387:15: Ineffective string escape `\('
lisp/obsolete/iswitchb.el:1396:21: Ineffective string escape `\*'
lisp/obsolete/old-whitespace.el:386:18: Ineffective string escape `\('
lisp/obsolete/old-whitespace.el:386:52: Ineffective string escape `\)'
lisp/obsolete/old-whitespace.el:387:19: Ineffective string escape `\('
lisp/obsolete/old-whitespace.el:387:53: Ineffective string escape `\)'
lisp/obsolete/old-whitespace.el:388:22: Ineffective string escape `\('
lisp/obsolete/old-whitespace.el:388:75: Ineffective string escape `\)'
lisp/obsolete/old-whitespace.el:389:30: Ineffective string escape `\('
lisp/obsolete/old-whitespace.el:389:65: Ineffective string escape `\)'
lisp/obsolete/vi.el:1228:34: Ineffective string escape `\''
lisp/obsolete/vi.el:1228:44: Ineffective string escape `\''
lisp/obsolete/rcompile.el:92:7: Ineffective string escape `\)'
lisp/obsolete/rcompile.el:92:28: Ineffective string escape `\('
lisp/obsolete/rcompile.el:92:34: Ineffective string escape `\)'
lisp/obsolete/pgg-pgp.el:43:32: Ineffective string escape `\('
lisp/obsolete/vip.el:83:18: Ineffective string escape `\)'
lisp/obsolete/vip.el:1513:26: Ineffective string escape `\('
lisp/obsolete/vip.el:1513:28: Ineffective string escape `\['
lisp/obsolete/vip.el:1722:38: Ineffective string escape `\('
lisp/obsolete/vip.el:1722:42: Ineffective string escape `\)'
lisp/obsolete/vip.el:1733:38: Ineffective string escape `\('
lisp/obsolete/vip.el:1733:42: Ineffective string escape `\)'
lisp/obsolete/vip.el:1744:33: Ineffective string escape `\('
lisp/obsolete/vip.el:1744:37: Ineffective string escape `\)'
lisp/obsolete/vip.el:2165:18: Ineffective string escape `\('
lisp/obsolete/vip.el:2165:46: Ineffective string escape `\)'
lisp/obsolete/vip.el:2671:42: Ineffective string escape `\('
lisp/obsolete/vip.el:2671:57: Ineffective string escape `\)'
lisp/obsolete/pgg-pgp5.el:58:32: Ineffective string escape `\('
lisp/format.el:516:12: Ineffective string escape `\('
lisp/format.el:577:40: Ineffective string escape `\('
lisp/format.el:599:47: Ineffective string escape `\('
lisp/format.el:614:52: Ineffective string escape `\('
lisp/format.el:824:28: Ineffective string escape `\('
lisp/format.el:859:18: Ineffective string escape `\('
lisp/format.el:867:23: Ineffective string escape `\('
lisp/format.el:867:37: Ineffective string escape `\('
lisp/nxml/xmltok.el:114:23: Ineffective string escape `\('
lisp/nxml/xmltok.el:127:13: Ineffective string escape `\('
lisp/nxml/nxml-parse.el:91:18: Ineffective string escape `\('
lisp/nxml/rng-valid.el:228:47: Ineffective string escape `\('
lisp/nxml/rng-cmpct.el:244:24: Ineffective string escape `\('
lisp/textmodes/reftex.el:2374:39: Ineffective string escape `\('
lisp/textmodes/fill.el:1138:32: Ineffective string escape `\('
lisp/textmodes/ispell.el:602:58: Ineffective string escape `\('
lisp/textmodes/enriched.el:170:24: Ineffective string escape `\('
lisp/textmodes/enriched.el:450:17: Ineffective string escape `\('
lisp/textmodes/tex-mode.el:287:37: Ineffective string escape `\('
lisp/textmodes/tex-mode.el:288:49: Ineffective string escape `\('
lisp/files.el:269:7: Ineffective string escape `\('
lisp/files.el:3540:51: Ineffective string escape `\('
lisp/org/ox.el:1762:22: Ineffective string escape `\('
lisp/org/org.el:11413:14: Ineffective string escape `\['
lisp/org/org.el:11414:14: Ineffective string escape `\['
lisp/org/org-list.el:2014:16: Ineffective string escape `\('
lisp/org/org-list.el:2014:36: Ineffective string escape `\('
lisp/org/org-list.el:2014:45: Ineffective string escape `\('
lisp/org/org-list.el:2797:17: Ineffective string escape `\('
lisp/org/org-element.el:4895:2: Ineffective string escape `\['
lisp/org/ol.el:848:30: Ineffective string escape `\]'
lisp/mail/rmail.el:316:8: Ineffective string escape `\('
lisp/mail/feedmail.el:638:24: Ineffective string escape `\('
lisp/mail/rmailedit.el:375:2: Ineffective string escape `\('
lisp/emulation/viper-macs.el:330:56: Ineffective string escape `\('
lisp/emulation/viper-util.el:1170:54: Ineffective string escape `\('
lisp/emulation/viper-mous.el:338:31: Ineffective string escape `\('
lisp/jka-cmpr-hook.el:291:17: Ineffective string escape `\('
lisp/jka-cmpr-hook.el:326:17: Ineffective string escape `\('
lisp/jka-cmpr-hook.el:341:17: Ineffective string escape `\('
lisp/follow.el:1699:41: Ineffective string escape `\('
lisp/image-dired.el:370:5: Ineffective string escape `\('
lisp/cedet/semantic/decorate/mode.el:48:19: Ineffective string escape `\('
lisp/comint.el:2771:31: Ineffective string escape `\('
lisp/char-fold.el:214:17: Ineffective string escape `\('
lisp/char-fold.el:225:5: Ineffective string escape `\('
lisp/help.el:889:10: Ineffective string escape `\('
lisp/hi-lock.el:365:10: Ineffective string escape `\('
lisp/vc/ediff-ptch.el:92:49: Ineffective string escape `\('
lisp/vc/vc-rcs.el:1129:7: Ineffective string escape `\('
lisp/vc/vc-rcs.el:1130:61: Ineffective string escape `\('
lisp/vc/vc-rcs.el:1133:42: Ineffective string escape `\('
lisp/vc/diff-mode.el:887:6: Ineffective string escape `\('
lisp/vc/ediff-util.el:1806:46: Ineffective string escape `\('
lisp/vc/ediff-util.el:2370:43: Ineffective string escape `\('
lisp/vc/ediff-wind.el:207:13: Ineffective string escape `\('
lisp/vc/ediff-wind.el:207:34: Ineffective string escape `\('
lisp/vc/vc-cvs.el:846:3: Ineffective string escape `\('
lisp/ps-print.el:1668:52: Ineffective string escape `\('
lisp/select.el:288:24: Ineffective string escape `\('
lisp/select.el:325:55: Ineffective string escape `\('
lisp/desktop.el:955:3: Ineffective string escape `\('
lisp/newcomment.el:1120:10: Ineffective string escape `\('
lisp/vcursor.el:575:55: Ineffective string escape `\('
lisp/woman.el:691:41: Ineffective string escape `\('
lisp/dired-aux.el:955:32: Ineffective string escape `\('
lisp/type-break.el:667:65: Ineffective string escape `\('
lisp/isearch.el:258:26: Ineffective string escape `\('
lisp/isearch.el:2825:33: Ineffective string escape `\('
lisp/view.el:452:21: Ineffective string escape `\('
lisp/erc/erc.el:261:26: Ineffective string escape `\('
lisp/erc/erc.el:267:26: Ineffective string escape `\('
lisp/erc/erc.el:268:3: Ineffective string escape `\('
lisp/erc/erc.el:275:26: Ineffective string escape `\('
lisp/erc/erc.el:276:3: Ineffective string escape `\('
lisp/erc/erc.el:2553:26: Ineffective string escape `\('
lisp/font-lock.el:1041:26: Ineffective string escape `\('
lisp/auth-source.el:334:33: Ineffective string escape `\('
lisp/auth-source.el:828:15: Ineffective string escape `\('
lisp/auth-source.el:830:7: Ineffective string escape `\('
lisp/progmodes/elisp-mode.el:1166:41: Ineffective string escape `\('
lisp/progmodes/elisp-mode.el:1346:48: Ineffective string escape `\('
lisp/progmodes/idlwave.el:4284:9: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:245:12: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:280:25: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:532:22: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:534:38: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:536:28: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:543:26: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:551:42: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:558:23: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:562:32: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:563:52: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:592:15: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:600:36: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:635:22: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:649:22: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:1621:8: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:1659:23: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:1660:29: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:1661:6: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:1817:52: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2003:42: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2059:10: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2076:23: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2076:30: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2140:23: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2140:44: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2186:6: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2188:23: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2192:22: Ineffective string escape `\('
lisp/progmodes/antlr-mode.el:2233:35: Ineffective string escape `\('
lisp/progmodes/sql.el:675:15: Ineffective string escape `\('
lisp/progmodes/cc-cmds.el:66:20: Ineffective string escape `\('
lisp/progmodes/cc-langs.el:494:12: Ineffective string escape `\('
lisp/progmodes/cc-langs.el:533:61: Ineffective string escape `\('
lisp/progmodes/cc-langs.el:1569:62: Ineffective string escape `\('
lisp/progmodes/idlw-shell.el:710:37: Ineffective string escape `\('
lisp/progmodes/idlw-shell.el:3172:29: Ineffective string escape `\('
lisp/progmodes/idlw-shell.el:3172:45: Ineffective string escape `\('
lisp/progmodes/cmacexp.el:159:42: Ineffective string escape `\('
lisp/international/mule-cmds.el:2460:41: Ineffective string escape `\('
lisp/international/quail.el:961:8: Ineffective string escape `\('
lisp/international/quail.el:2881:51: Ineffective string escape `\('
lisp/emacs-lisp/timer.el:181:13: Ineffective string escape `\('
lisp/emacs-lisp/check-declare.el:137:37: Ineffective string escape `\('
lisp/emacs-lisp/map-ynp.el:47:40: Ineffective string escape `\('
lisp/emacs-lisp/map-ynp.el:59:40: Ineffective string escape `\('
lisp/emacs-lisp/ert-x.el:191:51: Ineffective string escape `\('
lisp/emacs-lisp/shadow.el:71:52: Ineffective string escape `\('
lisp/emacs-lisp/shadow.el:73:54: Ineffective string escape `\('
lisp/emacs-lisp/subr-x.el:172:50: Ineffective string escape `\('
lisp/emacs-lisp/subr-x.el:173:6: Ineffective string escape `\('
lisp/emacs-lisp/bytecomp.el:534:7: Ineffective string escape `\('
test/lisp/textmodes/conf-mode-tests.el:165:14: Ineffective string escape `\['
test/lisp/help-fns-tests.el:59:39: Ineffective string escape `\.'
test/lisp/help-fns-tests.el:64:51: Ineffective string escape `\.'
test/lisp/help-fns-tests.el:69:51: Ineffective string escape `\.'
test/lisp/help-fns-tests.el:74:56: Ineffective string escape `\.'
test/lisp/help-fns-tests.el:80:59: Ineffective string escape `\.'
test/lisp/simple-tests.el:430:20: Ineffective string escape `\c'
test/lisp/ibuffer-tests.el:85:41: Ineffective string escape `\<'
test/lisp/ibuffer-tests.el:85:46: Ineffective string escape `\>'
test/lisp/international/ucs-normalize-tests.el:302:13: Ineffective string escape `\)'
test/lisp/emacs-lisp/ert-x-tests.el:228:21: Ineffective string escape `\('
test/src/regex-emacs-tests.el:164:26: Ineffective string escape `\['
test/src/regex-emacs-tests.el:330:12: Ineffective string escape `\{'
test/src/regex-emacs-tests.el:330:21: Ineffective string escape `\}'

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-01-26 16:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-24 15:12 Backslash-escaped brackets in string literals Mattias Engdegård
2020-01-24 15:39 ` Eli Zaretskii
2020-01-24 17:36 ` Stefan Monnier
2020-01-24 22:22   ` Mattias Engdegård
2020-01-25  7:44     ` Eli Zaretskii
2020-01-25 10:34       ` Mattias Engdegård
2020-01-25 13:33         ` Eli Zaretskii
2020-01-25 15:32           ` Mattias Engdegård
2020-01-25 17:15             ` Eli Zaretskii
2020-01-26 11:24               ` Mattias Engdegård
2020-01-26 16:00                 ` Eli Zaretskii
2020-01-25 17:16             ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).