From 8dc4034ed6f86455c294f22a3d345b00cd4aa143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Mon, 17 Feb 2020 18:26:47 +0100 Subject: Add and remove backslashes in regexps These irregularities were found by relint; see https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00949.html . * doc/lispref/modes.texi (Example Major Modes): * etc/srecode/el.srt: * lisp/cedet/data-debug.el (data-debug-mode): * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): * lisp/cedet/srecode/srt-mode.el (srecode-template-mode): * lisp/comint.el (comint--unquote&requote-argument): * lisp/emacs-lisp/lisp-mode.el (lisp-mode): * lisp/gnus/mm-uu.el (mm-uu-type-alist): * lisp/progmodes/cc-awk.el (c-awk-harmless-pattern-characters*): * lisp/progmodes/cfengine.el (cfengine-common-settings): * lisp/progmodes/cperl-mode.el (cperl-after-sub-regexp, cperl-init-faces): * lisp/shell.el (shell-chdrive-regexp, shell--unquote&requote-argument): * lisp/textmodes/tex-mode.el (tex-common-initialization): Remove duplicated backslashes in character alternatives. * lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): * lisp/progmodes/opascal.el (opascal--syntax-propertize): * lisp/progmodes/pascal.el (pascal--syntax-propertize): Remove backslashes escaping non-special characters. * lisp/progmodes/fortran.el (fortran-font-lock-keywords-3): Escape '*'. * lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): Escape '^'. --- doc/lispref/modes.texi | 2 +- etc/srecode/el.srt | 2 +- lisp/cedet/data-debug.el | 2 +- lisp/cedet/semantic/grammar.el | 2 +- lisp/cedet/srecode/srt-mode.el | 2 +- lisp/comint.el | 2 +- lisp/emacs-lisp/lisp-mode.el | 6 +++--- lisp/gnus/mm-uu.el | 2 +- lisp/progmodes/cc-awk.el | 2 +- lisp/progmodes/cfengine.el | 2 +- lisp/progmodes/cperl-mode.el | 8 ++++---- lisp/progmodes/fortran.el | 2 +- lisp/progmodes/opascal.el | 2 +- lisp/progmodes/pascal.el | 2 +- lisp/progmodes/perl-mode.el | 2 +- lisp/shell.el | 4 ++-- lisp/textmodes/tex-mode.el | 6 +++--- 17 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index f380f1669e0..f8cf4578fc2 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1428,7 +1428,7 @@ or to switch back to an existing one." (lisp-mode-variables nil t) (setq-local find-tag-default-function 'lisp-find-tag-default) (setq-local comment-start-skip - "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") + "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") (setq imenu-case-fold-search t)) @end group @end smallexample diff --git a/etc/srecode/el.srt b/etc/srecode/el.srt index 3473fb693c1..7d5c64c86c0 100644 --- a/etc/srecode/el.srt +++ b/etc/srecode/el.srt @@ -102,7 +102,7 @@ $") (0 font-lock-builtin-face)) ;; ELisp and CLisp `&' keywords as types. - (,(concat "\\_<\\&" lisp-mode-symbol-regexp "\\_>") + (,(concat "\\_<&" lisp-mode-symbol-regexp "\\_>") . font-lock-type-face) ;; ELisp regexp grouping constructs (,(lambda (bound) @@ -511,7 +511,7 @@ This will generate compile-time constants from BINDINGS." (,(concat "\\_<:" lisp-mode-symbol-regexp "\\_>") (0 font-lock-builtin-face)) ;; ELisp and CLisp `&' keywords as types. - (,(concat "\\_<\\&" lisp-mode-symbol-regexp "\\_>") + (,(concat "\\_<&" lisp-mode-symbol-regexp "\\_>") . font-lock-type-face) ;; This is too general -- rms. ;; A user complained that he has functions whose names start with `do' @@ -750,7 +750,7 @@ or to switch back to an existing one." (setq-local lisp-indent-function 'common-lisp-indent-function) (setq-local find-tag-default-function 'lisp-find-tag-default) (setq-local comment-start-skip - "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") + "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") (setq imenu-case-fold-search t)) (defun lisp-find-tag-default () diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el index 61bf0a78c0e..aedd6c948c2 100644 --- a/lisp/gnus/mm-uu.el +++ b/lisp/gnus/mm-uu.el @@ -192,7 +192,7 @@ This can be either \"inline\" or \"attachment\".") ,(lambda () (mm-uu-verbatim-marks-extract 0 0)) nil) (LaTeX - "^\\([\\\\%][^\n]+\n\\)*\\\\documentclass.*[[{%]" + "^\\([\\%][^\n]+\n\\)*\\\\documentclass.*[[{%]" "^\\\\end{document}" ,#'mm-uu-latex-extract nil diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el index fd61e3e3287..52e6da6f4ac 100644 --- a/lisp/progmodes/cc-awk.el +++ b/lisp/progmodes/cc-awk.el @@ -1003,7 +1003,7 @@ std\\(err\\|in\\|out\\)\\|user\\)\\)\\>\ ;; Matches an unterminated string/regexp, NOT including the eol at the end. (defconst c-awk-harmless-pattern-characters* - (concat "\\([^{;#/\"\\\\\n\r]\\|" c-awk-esc-pair-re "\\)*")) + (concat "\\([^{;#/\"\\\n\r]\\|" c-awk-esc-pair-re "\\)*")) ;; Matches any "harmless" character in a pattern or an escaped character pair. (defun c-awk-at-statement-end-p () diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el index 9ddb2ab2bbb..18df372f2c6 100644 --- a/lisp/progmodes/cfengine.el +++ b/lisp/progmodes/cfengine.el @@ -1322,7 +1322,7 @@ Use it by enabling `eldoc-mode'." (set (make-local-variable 'parens-require-spaces) nil) (set (make-local-variable 'comment-start) "# ") (set (make-local-variable 'comment-start-skip) - "\\(\\(?:^\\|[^\\\\\n]\\)\\(?:\\\\\\\\\\)*\\)#+[ \t]*") + "\\(\\(?:^\\|[^\\\n]\\)\\(?:\\\\\\\\\\)*\\)#+[ \t]*") ;; Like Lisp mode. Without this, we lose with, say, ;; `backward-up-list' when there's an unbalanced quote in a ;; preceding comment. diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 5fee2df5863..6f6da8e6b2e 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1306,7 +1306,7 @@ the last)." cperl-maybe-white-and-comment-rex ; whitespace-comments "\\(\\sw\\|_\\)+" ; attr-name ;; attr-arg (1 level of internal parens allowed!) - "\\((\\(\\\\.\\|[^\\\\()]\\|([^\\\\()]*)\\)*)\\)?" + "\\((\\(\\\\.\\|[^\\()]\\|([^\\()]*)\\)*)\\)?" "\\(" ; optional : (XXX allows trailing???) cperl-maybe-white-and-comment-rex ; whitespace-comments ":\\)?" @@ -5659,16 +5659,16 @@ indentation and initial hashes. Behaves usually outside of comment." '("^[ \t]*format[ \t]+\\([a-zA-Z_][a-zA-Z_0-9:]*\\)[ \t]*=[ \t]*$" 1 font-lock-function-name-face) (cond ((featurep 'font-lock-extra) - '("\\([]}\\\\%@>*&]\\|\\$[a-zA-Z0-9_:]*\\)[ \t]*{[ \t]*\\(-?[a-zA-Z0-9_:]+\\)[ \t]*}" + '("\\([]}\\%@>*&]\\|\\$[a-zA-Z0-9_:]*\\)[ \t]*{[ \t]*\\(-?[a-zA-Z0-9_:]+\\)[ \t]*}" (2 font-lock-string-face t) (0 '(restart 2 t)))) ; To highlight $a{bc}{ef} (font-lock-anchored - '("\\([]}\\\\%@>*&]\\|\\$[a-zA-Z0-9_:]*\\)[ \t]*{[ \t]*\\(-?[a-zA-Z0-9_:]+\\)[ \t]*}" + '("\\([]}\\%@>*&]\\|\\$[a-zA-Z0-9_:]*\\)[ \t]*{[ \t]*\\(-?[a-zA-Z0-9_:]+\\)[ \t]*}" (2 font-lock-string-face t) ("\\=[ \t]*{[ \t]*\\(-?[a-zA-Z0-9_:]+\\)[ \t]*}" nil nil (1 font-lock-string-face t)))) - (t '("\\([]}\\\\%@>*&]\\|\\$[a-zA-Z0-9_:]*\\)[ \t]*{[ \t]*\\(-?[a-zA-Z0-9_:]+\\)[ \t]*}" + (t '("\\([]}\\%@>*&]\\|\\$[a-zA-Z0-9_:]*\\)[ \t]*{[ \t]*\\(-?[a-zA-Z0-9_:]+\\)[ \t]*}" 2 font-lock-string-face t))) '("[[ \t{,(]\\(-?[a-zA-Z0-9_:]+\\)[ \t]*=>" 1 font-lock-string-face t) diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index 811951eaaaf..abc860b9478 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -429,7 +429,7 @@ The only difference is, it returns t in a case when the default returns nil." fortran-font-lock-keywords-1 ;; All type specifiers plus their declared items. (list - (list (concat fortran-type-types "[ \t(/]*\\(*\\)?") + (list (concat fortran-type-types "[ \t(/]*\\(\\*\\)?") ;; Type specifier. '(1 font-lock-type-face) ;; Declaration item (or just /.../ block name). diff --git a/lisp/progmodes/opascal.el b/lisp/progmodes/opascal.el index fcd9294f660..8c060991f42 100644 --- a/lisp/progmodes/opascal.el +++ b/lisp/progmodes/opascal.el @@ -1688,7 +1688,7 @@ comment block. If not in a // comment, just does a normal newline." ;; as comment starters. Fix it here by removing the "2" from the syntax ;; of the second char of such sequences. ("/\\(\\*\\)" (1 ". 3b")) - ("(\\(\\/\\)" (1 (prog1 ". 1c" (forward-char -1) nil))) + ("(\\(/\\)" (1 (prog1 ". 1c" (forward-char -1) nil))) ;; Pascal uses '' and "" rather than \' and \" to escape quotes. ("''\\|\"\"" (0 (if (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))) diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el index 13505d04a2d..5036b793c55 100644 --- a/lisp/progmodes/pascal.el +++ b/lisp/progmodes/pascal.el @@ -187,7 +187,7 @@ ;; as comment starters. Fix it here by removing the "2" from the syntax ;; of the second char of such sequences. ("/\\(\\*\\)" (1 ". 3b")) - ("(\\(\\/\\)" (1 (prog1 ". 1c" (forward-char -1) nil))) + ("(\\(/\\)" (1 (prog1 ". 1c" (forward-char -1) nil))) ;; Pascal uses '' and "" rather than \' and \" to escape quotes. ("''\\|\"\"" (0 (if (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index f864f6a34cd..ff0b6a331bc 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -235,7 +235,7 @@ (match-beginning 0)))))) (string-to-syntax ". p")))) ;; Handle funny names like $DB'stop. - ("\\$ ?{?^?[_[:alpha:]][_[:alnum:]]*\\('\\)[_[:alpha:]]" (1 "_")) + ("\\$ ?{?\\^?[_[:alpha:]][_[:alnum:]]*\\('\\)[_[:alpha:]]" (1 "_")) ;; format statements ("^[ \t]*format.*=[ \t]*\\(\n\\)" (1 (prog1 "\"" (perl-syntax-propertize-special-constructs end)))) diff --git a/lisp/shell.el b/lisp/shell.el index ecebf937e29..1e2679f7235 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -252,7 +252,7 @@ This mirrors the optional behavior of tcsh." (defcustom shell-chdrive-regexp (if (memq system-type '(ms-dos windows-nt)) ; NetWare allows the five chars between upper and lower alphabetics. - "[]a-zA-Z^_`\\[\\\\]:" + "[]a-zA-Z^_`[\\]:" nil) "If non-nil, is regexp used to track drive changes." :type '(choice regexp @@ -377,7 +377,7 @@ Thus, this does not include the shell's current directory.") "\\|\\$\\(?:\\([[:alpha:]][[:alnum:]]*\\)" "\\|{\\(?1:[^{}]+\\)}\\)" (when (memq system-type '(ms-dos windows-nt)) - "\\|%\\(?1:[^\\\\/]*\\)%") + "\\|%\\(?1:[^\\/]*\\)%") (when comint-file-name-quote-list "\\|\\\\\\(.\\)"))) (qupos nil) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 0e28756ea75..f95979e2fcb 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -465,7 +465,7 @@ An alternative value is \" . \", if you use a font with a narrow period." ; ("{\\\\bf\\([^}]+\\)}" 1 'bold keep) ; ("{\\\\\\(em\\|it\\|sl\\)\\([^}]+\\)}" 2 'italic keep) ; ("\\\\\\([a-zA-Z@]+\\|.\\)" . font-lock-keyword-face) -; ("^[ \t\n]*\\\\def[\\\\@]\\(\\w+\\)" 1 font-lock-function-name-face keep)) +; ("^[ \t\n]*\\\\def[\\@]\\(\\w+\\)" 1 font-lock-function-name-face keep)) ; ;; Rewritten and extended for LaTeX2e by Ulrik Dickow . ; '(("\\\\\\(begin\\|end\\|newcommand\\){\\([a-zA-Z0-9\\*]+\\)}" ; 2 font-lock-function-name-face) @@ -1252,10 +1252,10 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook ("\\\\[a-zA-Z]+\\( +\\|{}\\)[a-zA-Z]*" . "") ("%" . "$")))) ;; A line containing just $$ is treated as a paragraph separator. - (setq-local paragraph-start "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$") + (setq-local paragraph-start "[ \t]*$\\|[\f\\%]\\|[ \t]*\\$\\$") ;; A line starting with $$ starts a paragraph, ;; but does not separate paragraphs if it has more stuff on it. - (setq-local paragraph-separate "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$[ \t]*$") + (setq-local paragraph-separate "[ \t]*$\\|[\f\\%]\\|[ \t]*\\$\\$[ \t]*$") (setq-local add-log-current-defun-function #'tex-current-defun-name) (setq-local comment-start "%") (setq-local comment-add 1) -- cgit v1.2.1