]> git.eshelyaron.com Git - emacs.git/commitdiff
More regexp corrections and tweaks
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Mar 2019 17:08:46 +0000 (09:08 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Mar 2019 17:09:40 +0000 (09:09 -0800)
From suggestions by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00131.html
* lisp/arc-mode.el (archive-rar-summarize):
* lisp/gnus/gnus-art.el (gnus-button-valid-localpart-regexp):
* lisp/language/ethio-util.el (ethio-fidel-to-tex-buffer):
* lisp/nxml/rng-uri.el (rng-file-name-uri):
* lisp/org/org-mobile.el (org-mobile-apply):
* lisp/progmodes/cperl-mode.el (cperl-init-faces):
* lisp/progmodes/fortran.el (fortran-fill):
* lisp/progmodes/mantemp.el (mantemp-remove-comments)
(mantemp-remove-memfuncs, mantemp-insert-cxx-syntax):
* lisp/speedbar.el (speedbar-directory-buttons-follow):
* lisp/vc/add-log.el (change-log-font-lock-keywords):
Fix more regular expressions that seem to be typos or infelicities.

lisp/arc-mode.el
lisp/gnus/gnus-art.el
lisp/language/ethio-util.el
lisp/nxml/rng-uri.el
lisp/org/org-mobile.el
lisp/progmodes/cperl-mode.el
lisp/progmodes/fortran.el
lisp/progmodes/mantemp.el
lisp/speedbar.el
lisp/vc/add-log.el

index 2afde7ee75a52555b2d732d019e4e2c4abbdfed8..6a58d61a547058a12ebae5a577df4416e27581bf 100644 (file)
@@ -2016,7 +2016,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
       (call-process "lsar" nil t nil "-l" (or file copy))
       (if copy (delete-file copy))
       (goto-char (point-min))
-      (re-search-forward "^\\(\s+=+\s+\\)+\n")
+      (re-search-forward "^\\(\s+=+\s*\\)+\n")
       (while (looking-at (concat "^\s+[0-9.]+\s+D?-+\s+"   ; Flags
                                  "\\([0-9-]+\\)\s+"        ; Size
                                  "\\([-0-9.%]+\\|-+\\)\s+" ; Ratio
index fa3abfac585d23f2e3fe0e19789eb7be0484091a..baf44cb48306a6e20e55f73de60492c3d6378a88 100644 (file)
@@ -7376,9 +7376,8 @@ groups."
   :group 'gnus-article-buttons
   :type 'regexp)
 
-;; Regexp suggested by Felix Wiemann in <87oeuomcz9.fsf@news2.ososo.de>
 (defcustom gnus-button-valid-localpart-regexp
-  "[a-z$%(*-=?[_][^<>\")!;:,{}\n\t @]*"
+  "[-a-z0-9$%(*+./=?[_][^<>\")!;:,{}\n\t @]*"
   "Regular expression that matches a localpart of mail addresses or MIDs."
   :version "22.1"
   :group 'gnus-article-buttons
index 512d49b9c5da7eaf305fad3159154d37872f4ca4..04b15ddd9a8c07daf0c352bad66f3e12c9b9c848 100644 (file)
@@ -804,7 +804,7 @@ The 2nd and 3rd arguments BEGIN and END specify the region."
 
     ;; Special Ethiopic punctuation.
     (goto-char (point-min))
-    (while (re-search-forward "\\ce[»\\.?]\\|«\\ce" nil t)
+    (while (re-search-forward "\\ce[».?]\\|«\\ce" nil t)
       (cond
        ((= (setq ch (preceding-char)) ?\»)
        (delete-char -1)
index d8f2884f5e61d1b9b416e24c317ceb15defd733c..798475bbc3da2a5e679952cd94486f0d86f89291 100644 (file)
@@ -30,9 +30,10 @@ Multibyte characters are left as is.  Use `rng-uri-escape-multibyte' to
 escape them using %HH."
   (setq f (expand-file-name f))
   (let ((url
-        (replace-regexp-in-string "[\000-\032\177<>#%\"{}|\\^[]`%?;]"
-                                  'rng-percent-encode
-                                  f)))
+        ;; FIXME. Explain why the pattern doesn't also have "!$&'()*+,/:@=".
+        ;; See Internet RFC 3986 section 2.2.
+        (replace-regexp-in-string "[]\0-\s\"#%;<>?[\\^`{|}\177]"
+                                  'rng-percent-encode f)))
     (concat "file:"
            (if (and (> (length url) 0)
                     (= (aref url 0) ?/))
index 83dcc7b0d135668a04cc6527ae539a18d85276f3..8b4e895388964010a9e0f5326c16ff486e85afc6 100644 (file)
@@ -845,11 +845,11 @@ If BEG and END are given, only do this in that region."
            (cl-incf cnt-error)
            (throw 'next t))
          (move-marker bos-marker (point))
-         (if (re-search-forward "^\\*\\* Old value[ \t]*$" eos t)
+         (if (re-search-forward "^\\** Old value[ \t]*$" eos t)
              (setq old (buffer-substring
                         (1+ (match-end 0))
                         (progn (outline-next-heading) (point)))))
-         (if (re-search-forward "^\\*\\* New value[ \t]*$" eos t)
+         (if (re-search-forward "^\\** New value[ \t]*$" eos t)
              (setq new (buffer-substring
                         (1+ (match-end 0))
                         (progn (outline-next-heading)
index 0fe4b106c53620a8f5197a46cc57d32bd56e36b4..a9402e17a920a3a6b20a29ce539e56cc07ed4e90 100644 (file)
@@ -5736,9 +5736,9 @@ indentation and initial hashes.  Behaves usually outside of comment."
                         (if (eq (char-after (cperl-1- (match-end 0))) ?\{ )
                             'font-lock-function-name-face
                           'font-lock-variable-name-face))))
-           '("\\<\\(package\\|require\\|use\\|import\\|no\\|bootstrap\\)[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t;]" ; require A if B;
+           '("\\<\\(package\\|require\\|use\\|import\\|no\\|bootstrap\\)[ \t]+\\([a-zA-Z_][a-zA-Z_0-9:]*\\)[ \t;]" ; require A if B;
              2 font-lock-function-name-face)
-           '("^[ \t]*format[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t]*=[ \t]*$"
+           '("^[ \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]*}"
index c1a267f4c5e39413cd44fefa505823497eb4e38d..b8aa521cf66db806aa082ba39368986a27f47e96 100644 (file)
@@ -2052,7 +2052,7 @@ If ALL is nil, only match comments that start in column > 0."
                 (when (<= (point) bos)
                   (move-to-column (1+ fill-column))
                   ;; What is this doing???
-                  (or (re-search-forward "[-\t\n,'+./*)=]" eol t)
+                  (or (re-search-forward "[-\t\n,'+/*)=]" eol t)
                       (goto-char bol)))
                 (if (bolp)
                     (re-search-forward "[ \t]" opoint t))
index 9beeb4aae6276028655cc295c34338b2da457632..4190a847274b52ab1cc880223c86cd0414904277 100644 (file)
@@ -89,7 +89,7 @@
   (save-excursion
     (goto-char (point-min))
     (message "Removing comments")
-    (while (re-search-forward "^[A-z.()+0-9: ]*`\\|'.*$" nil t)
+    (while (re-search-forward "^[a-zA-Z.()+0-9: ]*`\\|'.*$" nil t)
       (replace-match ""))))
 
 (defun mantemp-remove-memfuncs ()
     (goto-char (point-min))
     (message "Removing member function extensions")
     (while (re-search-forward
-           "^[A-z :&*<>~=,0-9+]*>::operator " nil t nil)
+           "^[a-zA-Z :&*<>~=,0-9+]*>::operator " nil t nil)
       (progn
        (backward-char 11)
        (delete-region (point) (line-end-position))))
     ;; Remove other member function extensions.
     (goto-char (point-min))
     (message "Removing member function extensions")
-    (while (re-search-forward "^[A-z :&*<>~=,0-9+]*>::" nil t nil)
+    (while (re-search-forward "^[a-zA-Z :&*<>~=,0-9+]*>::" nil t nil)
       (progn
        (backward-char 2)
        (delete-region (point) (line-end-position))))))
@@ -154,7 +154,7 @@ the lines."
     (goto-char (point-min))
     (message "Inserting 'template' for functions")
     (while (re-search-forward
-           "^template class [A-z :&*<>~=,0-9+!]*(" nil t nil)
+           "^template class [a-zA-Z :&*<>~=,0-9+!]*(" nil t nil)
       (progn
        (beginning-of-line)
        (forward-word-strictly 1)
index 46b3f2ea90bfce43fa0673668a10dece4171ff98..a7fd564e94812e47c37af11bece7e7dd1afd7b57 100644 (file)
@@ -3388,7 +3388,7 @@ expanded.  INDENT is the current indentation level."
   "Speedbar click handler for default directory buttons.
 TEXT is the button clicked on.  TOKEN is the directory to follow.
 INDENT is the current indentation level and is unused."
-  (if (string-match "^[A-z]:$" token)
+  (if (string-match "^[A-Za-z]:$" token)
       (setq default-directory (concat token "/"))
     (setq default-directory token))
   ;; Because we leave speedbar as the current buffer,
index 9fe06bbf5289c2e4401319b58fe9f7fa6fcfbbb3..f9efd44c5c7fbc304c9192058c59ddc4ffbb095d 100644 (file)
@@ -239,7 +239,7 @@ a case simply use the directory containing the changed file."
     ;; wrongly with a non-date line existing as a random note.  In
     ;; addition, using any kind of fixed setting like this doesn't
     ;; work if a user customizes add-log-time-format.
-    ("^[0-9-]+ +\\|^ \\{11,\\}\\|^\t \\{3,\\}\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+"
+    ("^[0-9-]+ +\\|^ \\{11,\\}\\|^\t \\{3,\\}\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-Z][a-z][a-z] [0-9:+ ]+"
      (0 'change-log-date)
      ;; Name and e-mail; some people put e-mail in parens, not angles.
      ("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil