]> git.eshelyaron.com Git - emacs.git/commitdiff
More minor regex cleanup
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Mar 2019 01:45:17 +0000 (18:45 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Mar 2019 01:47:53 +0000 (18:47 -0700)
Problems reported by Mattias EngdegĂ„rd in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00643.html
plus a few others that I noticed.
* lisp/auth-source-pass.el (auth-source-pass--parse-data):
* lisp/org/org-datetree.el (org-datetree--find-create):
* lisp/org/org-pcomplete.el (org-thing-at-point):
* lisp/progmodes/js.el (js--end-of-do-while-loop-p):
* lisp/textmodes/sgml-mode.el:
(sgml-electric-tag-pair-before-change-function):
* lisp/textmodes/texnfo-upd.el (texinfo-menu-copy-old-description):
* lisp/url/url-http.el (url-http-parse-response):
Fix regular expression and similar syntax.

lisp/auth-source-pass.el
lisp/org/org-datetree.el
lisp/org/org-pcomplete.el
lisp/progmodes/cperl-mode.el
lisp/progmodes/js.el
lisp/textmodes/sgml-mode.el
lisp/textmodes/texnfo-upd.el
lisp/url/url-http.el

index 29ff9c66856c45b2ad9b592531ad5a22909c2814..4283ed0392bc5e0a2f94bff045019990ce778de4 100644 (file)
@@ -139,7 +139,7 @@ The secret is the first line of CONTENTS."
 (defun auth-source-pass--parse-data (contents)
   "Parse the password-store data in the string CONTENTS and return an alist.
 CONTENTS is the contents of a password-store formatted file."
-  (let ((lines (split-string contents "\n" t "\\\s")))
+  (let ((lines (split-string contents "\n" t "[ \t]+")))
     (seq-remove #'null
                 (mapcar (lambda (line)
                           (let ((pair (mapcar (lambda (s) (string-trim s))
index aea2c8d3d61f5a8e6210f1157b6c018354100f9f..b4797de1e58472abbc7e8b02f24534aa4c8485ef 100644 (file)
@@ -138,15 +138,16 @@ will be built under the headline at point."
        "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
        year month day))))
 
-(defun org-datetree--find-create (regex year &optional month day insert)
-  "Find the datetree matched by REGEX for YEAR, MONTH, or DAY.
-REGEX is passed to `format' with YEAR, MONTH, and DAY as
+(defun org-datetree--find-create
+    (regex-template year &optional month day insert)
+  "Find the datetree matched by REGEX-TEMPLATE for YEAR, MONTH, or DAY.
+REGEX-TEMPLATE is passed to `format' with YEAR, MONTH, and DAY as
 arguments.  Match group 1 is compared against the specified date
 component.  If INSERT is non-nil and there is no match then it is
 inserted into the buffer."
   (when (or month day)
     (org-narrow-to-subtree))
-  (let ((re (format regex year month day))
+  (let ((re (format regex-template year month day))
        match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))
index 49983c40a52da8cd534612169beb7f0248505fd8..cf272de90a8c2a72a104ab3d172d1f22e23a6eb8 100644 (file)
   "Examine the thing at point and let the caller know what it is.
 The return value is a string naming the thing at point."
   (let ((beg1 (save-excursion
-               (skip-chars-backward "[:alnum:]-_@")
+               (skip-chars-backward "-[:alnum:]_@")
                (point)))
        (beg (save-excursion
-              (skip-chars-backward "a-zA-Z0-9-_:$")
+              (skip-chars-backward "-a-zA-Z0-9_:$")
               (point)))
        (line-to-here (buffer-substring (point-at-bol) (point))))
     (cond
index 0b6008a5114914398a457b2de912c37a363fd51c..73b55e29a5a67ea8f7411e4d7f82721668ccf9e8 100644 (file)
@@ -1884,7 +1884,7 @@ or as help on variables `cperl-tips', `cperl-problems',
 ;;Point is at start of real comment."
 ;;  (let ((c (current-column)) target cnt prevc)
 ;;    (if (= c comment-column) nil
-;;      (setq cnt (skip-chars-backward "[ \t]"))
+;;      (setq cnt (skip-chars-backward " \t"))
 ;;      (setq target (max (1+ (setq prevc
 ;;                          (current-column))) ; Else indent at comment column
 ;;                comment-column))
index f1ec5ceea56ff0c5d0f16f75c4c369bc1aff1fd9..4d91da7334045fc3ae949eb301bba8610fa2c043 100644 (file)
@@ -1908,7 +1908,7 @@ the same column as the current line."
     (save-match-data
       (when (looking-at "\\s-*\\_<while\\_>")
        (if (save-excursion
-             (skip-chars-backward "[ \t\n]*}")
+             (skip-chars-backward " \t\n}")
              (looking-at "[ \t\n]*}"))
            (save-excursion
              (backward-list) (forward-symbol -1) (looking-at "\\_<do\\_>"))
index e49144e29006f4321456dddcc2fe74bcf7683875..9e3be99af14d6c8bd6febbc6203322f02d579043 100644 (file)
@@ -894,7 +894,7 @@ Return non-nil if we skipped over matched tags."
   (condition-case err
   (save-excursion
     (goto-char end)
-    (skip-chars-backward "[:alnum:]-_.:")
+    (skip-chars-backward "-[:alnum:]_.:")
     (if (and ;; (<= (point) beg) ; This poses problems for downcase-word.
              (or (eq (char-before) ?<)
                  (and (eq (char-before) ?/)
@@ -902,7 +902,7 @@ Return non-nil if we skipped over matched tags."
              (null (get-char-property (point) 'text-clones)))
         (let* ((endp (eq (char-before) ?/))
                (cl-start (point))
-               (cl-end (progn (skip-chars-forward "[:alnum:]-_.:") (point)))
+              (cl-end (progn (skip-chars-forward "-[:alnum:]_.:") (point)))
                (match
                 (if endp
                     (when (sgml-skip-tag-backward 1) (forward-char 1) t)
@@ -919,7 +919,8 @@ Return non-nil if we skipped over matched tags."
                      (equal (buffer-substring cl-start cl-end)
                             (buffer-substring (point)
                                               (save-excursion
-                                                (skip-chars-forward "[:alnum:]-_.:")
+                                               (skip-chars-forward
+                                                "-[:alnum:]_.:")
                                                 (point))))
                      (or (not endp) (eq (char-after cl-end) ?>)))
             (when clones
index 8c6e23eae4afa8c4bcd9a2c58c2032b764d55a49..e960e992a89f473c1244f366bbdfd8d2cc0c6d64 100644 (file)
@@ -642,7 +642,7 @@ appears in the texinfo file."
   "Return description field of old menu line as string.
 Point must be located just after the node name.  Point left before description.
 Single argument, END-OF-MENU, is position limiting search."
-  (skip-chars-forward "[:.,\t\n ]+")
+  (skip-chars-forward ":.,\t\n ")
   ;; don't copy a carriage return at line beginning with asterisk!
   ;; don't copy @detailmenu or @end menu or @ignore as descriptions!
   ;; do copy a description that begins with an `@'!
index 46baa8a1482e2ef6d4f91c65224b6de1a0a7ec8f..1fbc087073736ddbfcd34f8fac086794ae99a1a7 100644 (file)
@@ -517,7 +517,7 @@ Return the number of characters removed."
   (setq url-http-response-version
        (buffer-substring (point)
                          (progn
-                           (skip-chars-forward "[0-9].")
+                           (skip-chars-forward "0-9.")
                            (point))))
   (setq url-http-response-status (read (current-buffer))))