Fix some ineffective backslashes in string literals

Deal with lone backslashes that have no effect in string literals,
but indicate that something is amiss.

* lisp/auth-source-pass.el (auth-source-pass-entries):
* lisp/textmodes/artist.el (artist-figlet-get-font-list-windows):
* lisp/org/ob-abc.el (org-babel-expand-body:abc, org-babel-execute:abc):
* lisp/org/ob-forth.el (org-babel-forth-session-execute):
* lisp/vc/vc-git.el (vc-git--program-version):
Add backslash in regexp for correctness.

* lisp/gnus/nnmail.el (nnmail-split-abbrev-alist):
Replace `\||' with `\\|' to follow the obvious regexp intent.

* lisp/org/org-list.el (org-plain-list-ordered-item-terminator):
Add backslash in doc comment so that it appears as intended.

* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1, c-end-of-decl-1):
* lisp/progmodes/f90.el (f90-font-lock-keywords-2):
* lisp/progmodes/etags.el (etags-tags-completion-table):
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize):
* test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-1):
Remove superfluous backslashes from regexp.

* test/lisp/emacs-lisp/rx-tests.el (rx-char-any):
Remove superfluous backslash from doc comment.
This commit is contained in:
Mattias Engdegård 2019-03-16 11:36:38 -07:00 committed by Paul Eggert
parent 34dd4e0a83
commit 8832cc5f91
13 changed files with 16 additions and 16 deletions

View file

@ -189,7 +189,7 @@ often."
(let ((store-dir (expand-file-name "~/.password-store/")))
(mapcar
(lambda (file) (file-name-sans-extension (file-relative-name file store-dir)))
(directory-files-recursively store-dir "\.gpg$"))))
(directory-files-recursively store-dir "\\.gpg$"))))
(defun auth-source-pass--find-all-by-entry-name (entryname user)
"Search the store for all entries either matching ENTRYNAME/USER or ENTRYNAME.

View file

@ -489,7 +489,7 @@ Example:
(from . "from\\|sender\\|resent-from")
(nato . "to\\|cc\\|resent-to\\|resent-cc")
(naany . "from\\|to\\|cc\\|sender\\|resent-from\\|resent-to\\|resent-cc")
(list . "list-id\\|list-post\\|x-mailing-list\||x-beenthere\\|x-loop"))
(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop"))
"Alist of abbreviations allowed in `nnmail-split-fancy'."
:group 'nnmail-split
:type '(repeat (cons :format "%v" symbol regexp)))

View file

@ -47,7 +47,7 @@
(value (cdr pair)))
(setq body
(replace-regexp-in-string
(concat "\$" (regexp-quote name))
(concat "\\$" (regexp-quote name))
(if (stringp value) value (format "%S" value))
body))))
vars)
@ -59,7 +59,7 @@
(message "executing Abc source code block")
(let* ((cmdline (cdr (assq :cmdline params)))
(out-file (let ((file (cdr (assq :file params))))
(if file (replace-regexp-in-string "\.pdf$" ".ps" file)
(if file (replace-regexp-in-string "\\.pdf$" ".ps" file)
(error "abc code block requires :file header argument"))))
(in-file (org-babel-temp-file "abc-"))
(render (concat "abcm2ps" " " cmdline

View file

@ -53,7 +53,7 @@ This function is called by `org-babel-execute-src-block'"
(defun org-babel-forth-session-execute (body params)
(require 'forth-mode)
(let ((proc (forth-proc))
(rx " \\(\n:\\|compiled\n\\\|ok\n\\)")
(rx " \\(\n:\\|compiled\n\\|ok\n\\)")
(result-start))
(with-current-buffer (process-buffer (forth-proc))
(mapcar (lambda (line)

View file

@ -236,7 +236,7 @@ into
(defcustom org-plain-list-ordered-item-terminator t
"The character that makes a line with leading number an ordered list item.
Valid values are ?. and ?\). To get both terminators, use t.
Valid values are ?. and ?\\). To get both terminators, use t.
This variable needs to be set before org.el is loaded. If you
need to make a change while Emacs is running, use the customize

View file

@ -8968,7 +8968,7 @@ This function might do hidden buffer changes."
(setq at-decl-end
(looking-at (cond ((eq context '<>) "[,>]")
((not (memq context '(nil top))) "[,\)]")
((not (memq context '(nil top))) "[,)]")
(t "[,;]"))))
;; Now we've collected info about various characteristics of
@ -10321,7 +10321,7 @@ comment at the start of cc-engine.el for more info."
;; Check for `c-opt-block-decls-with-vars-key'
;; before the first paren.
(c-syntactic-re-search-forward
(concat "[;=\(\[{]\\|\\("
(concat "[;=([{]\\|\\("
c-opt-block-decls-with-vars-key
"\\)")
lim t t t)
@ -10329,7 +10329,7 @@ comment at the start of cc-engine.el for more info."
(not (eq (char-before) ?_))
;; Check that the first following paren is
;; the block.
(c-syntactic-re-search-forward "[;=\(\[{]"
(c-syntactic-re-search-forward "[;=([{]"
lim t t t)
(eq (char-before) ?{))))))
;; The declaration doesn't have any of the

View file

@ -1281,7 +1281,7 @@ buffer-local values of tags table format variables."
;; This regexp matches an explicit tag name or the place where
;; it would start.
(while (re-search-forward
"[\f\t\n\r()=,; ]?\177\\\(?:\\([^\n\001]+\\)\001\\)?"
"[\f\t\n\r()=,; ]?\177\\(?:\\([^\n\001]+\\)\001\\)?"
nil t)
(push (prog1 (if (match-beginning 1)
;; There is an explicit tag name.

View file

@ -648,7 +648,7 @@ forall\\|block\\|critical\\)\\)\\_>"
\\|enumerator\\|procedure\\|\
logical\\|double[ \t]*precision\\|type[ \t]*(\\(?:\\sw\\|\\s_\\)+)\\|none\\)[ \t]*"
(1 font-lock-keyword-face) (2 font-lock-type-face))
'("\\_<\\(namelist\\|common\\)[ \t]*/\\(\\(?:\\sw\\|\\s_\\)+\\)?\/"
'("\\_<\\(namelist\\|common\\)[ \t]*/\\(\\(?:\\sw\\|\\s_\\)+\\)?/"
(1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
"\\_<else\\([ \t]*if\\|where\\)?\\_>"
'("\\(&\\)[ \t]*\\(!\\|$\\)" (1 font-lock-keyword-face))

View file

@ -1867,7 +1867,7 @@ It will be properly highlighted even when the call omits parens.")
("^[ \t]*def +\\(`\\)" (1 "_"))
;; Ternary operator colon followed by opening paren or bracket
;; (semi-important for indentation).
("\\(:\\)\\(?:[\({]\\|\\[[^]]\\)"
("\\(:\\)\\(?:[({]\\|\\[[^]]\\)"
(1 (string-to-syntax ".")))
;; Regular expressions. Start with matching unescaped slash.
("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)"

View file

@ -2895,7 +2895,7 @@ Returns a list of strings."
dir-list)
(mapcar
(lambda (file)
(replace-regexp-in-string "\.flf\\'" "" file))
(replace-regexp-in-string "\\.flf\\'" "" file))
result))))
(defun artist-figlet-choose-font ()

View file

@ -253,7 +253,7 @@ The following place holders should be present in the string:
;; Git for Windows appends ".windows.N" to the
;; numerical version reported by Git.
(string-match
"git version \\([0-9.]+\\)\\(\.windows.[0-9]+\\)?$"
"git version \\([0-9.]+\\)\\(\\.windows.[0-9]+\\)?$"
version-string))
(match-string 1 version-string)
"0")))))

View file

@ -34,7 +34,7 @@
(let ((print-circle t))
(should (equal (cl-prin1-to-string `((x . ,x) (y . ,x)))
"((x . #1=#s(cl-print--test :a 1 :b 2)) (y . #1#))")))
(should (string-match "\\`#f(compiled-function (x) \"[^\"]+\" [^\)]*)\\'"
(should (string-match "\\`#f(compiled-function (x) \"[^\"]+\" [^)]*)\\'"
(cl-prin1-to-string (symbol-function #'caar))))))
(ert-deftest cl-print-tests-2 ()

View file

@ -25,7 +25,7 @@
;;; Code:
(ert-deftest rx-char-any ()
"Test character alternatives with `\]' and `-' (Bug#25123)."
"Test character alternatives with `]' and `-' (Bug#25123)."
(should (string-match
(rx string-start (1+ (char (?\] . ?\{) (?< . ?\]) (?- . ?:)))
string-end)