emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8dc4034 2/3: Add and remove backslashes in regexps


From: Mattias Engdegård
Subject: master 8dc4034 2/3: Add and remove backslashes in regexps
Date: Thu, 20 Feb 2020 10:05:54 -0500 (EST)

branch: master
commit 8dc4034ed6f86455c294f22a3d345b00cd4aa143
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    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 f380f16..f8cf457 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 3473fb6..7d5c64c 100644
--- a/etc/srecode/el.srt
+++ b/etc/srecode/el.srt
@@ -102,7 +102,7 @@ $<MODEFCN:declaration:function$
        comment-start ";;"
        comment-end "")
   (set (make-local-variable 'comment-start-skip)
-       "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
+       "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
   (set-syntax-table $MODESYM$-mode-syntax-table)
   (use-local-map $MODESYM$-mode-map)
   (set (make-local-variable 'font-lock-defaults)
diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el
index 78a72dd..075e122 100644
--- a/lisp/cedet/data-debug.el
+++ b/lisp/cedet/data-debug.el
@@ -880,7 +880,7 @@ If PARENT is non-nil, it is somehow related as a parent to 
thing."
        comment-end ""
        buffer-read-only t)
   (setq-local comment-start-skip
-       "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
+       "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
   (buffer-disable-undo)
   (set (make-local-variable 'font-lock-global-modes) nil)
   (font-lock-mode -1)
diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el
index 62c86f9..2c3b24b 100644
--- a/lisp/cedet/semantic/grammar.el
+++ b/lisp/cedet/semantic/grammar.el
@@ -1306,7 +1306,7 @@ the change bounds to encompass the whole nonterminal tag."
   ;; Look within the line for a ; following an even number of backslashes
   ;; after either a non-backslash or the line beginning.
   (set (make-local-variable 'comment-start-skip)
-       "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
+       "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
   (set (make-local-variable 'indent-line-function)
        'semantic-grammar-indent)
   (set (make-local-variable 'fill-paragraph-function)
diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el
index 6b8c303..4c1e030 100644
--- a/lisp/cedet/srecode/srt-mode.el
+++ b/lisp/cedet/srecode/srt-mode.el
@@ -195,7 +195,7 @@ we can tell font lock about them.")
   (set (make-local-variable 'comment-end) "")
   (set (make-local-variable 'parse-sexp-ignore-comments) t)
   (set (make-local-variable 'comment-start-skip)
-       "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
+       "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
   (set (make-local-variable 'font-lock-defaults)
        '(srecode-font-lock-keywords
          nil  ;; perform string/comment fontification
diff --git a/lisp/comint.el b/lisp/comint.el
index bf376a0..5c521ff 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3124,7 +3124,7 @@ See `comint-word'."
               "\\$\\(?:\\([[: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/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index f66122d..3b0f549 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -456,7 +456,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)
          ;; 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 61bf0a7..aedd6c9 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 fd61e3e..52e6da6 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 9ddb2ab..18df372 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 5fee2df..6f6da8e 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 811951e..abc860b 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 fcd9294..8c06099 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 13505d0..5036b79 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 f864f6a..ff0b6a3 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 ecebf93..1e2679f 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 0e28756..f95979e 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 <address@hidden>.
 ;  '(("\\\\\\(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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]