aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-03-19 18:45:17 -0700
committerPaul Eggert2019-03-19 18:47:53 -0700
commite14c0d748efe35afc653151ff18c4dd93dcc456e (patch)
treef31050be99133f3466413728c2c948ab7914fcb7
parentb2dd61ffb0b4efc0419f4b5cbe279c2700b549e8 (diff)
downloademacs-e14c0d748efe35afc653151ff18c4dd93dcc456e.tar.gz
emacs-e14c0d748efe35afc653151ff18c4dd93dcc456e.zip
More minor regex cleanup
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.
-rw-r--r--lisp/auth-source-pass.el2
-rw-r--r--lisp/org/org-datetree.el9
-rw-r--r--lisp/org/org-pcomplete.el4
-rw-r--r--lisp/progmodes/cperl-mode.el2
-rw-r--r--lisp/progmodes/js.el2
-rw-r--r--lisp/textmodes/sgml-mode.el7
-rw-r--r--lisp/textmodes/texnfo-upd.el2
-rw-r--r--lisp/url/url-http.el2
8 files changed, 16 insertions, 14 deletions
diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index 29ff9c66856..4283ed0392b 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -139,7 +139,7 @@ The secret is the first line of CONTENTS."
139(defun auth-source-pass--parse-data (contents) 139(defun auth-source-pass--parse-data (contents)
140 "Parse the password-store data in the string CONTENTS and return an alist. 140 "Parse the password-store data in the string CONTENTS and return an alist.
141CONTENTS is the contents of a password-store formatted file." 141CONTENTS is the contents of a password-store formatted file."
142 (let ((lines (split-string contents "\n" t "\\\s"))) 142 (let ((lines (split-string contents "\n" t "[ \t]+")))
143 (seq-remove #'null 143 (seq-remove #'null
144 (mapcar (lambda (line) 144 (mapcar (lambda (line)
145 (let ((pair (mapcar (lambda (s) (string-trim s)) 145 (let ((pair (mapcar (lambda (s) (string-trim s))
diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el
index aea2c8d3d61..b4797de1e58 100644
--- a/lisp/org/org-datetree.el
+++ b/lisp/org/org-datetree.el
@@ -138,15 +138,16 @@ will be built under the headline at point."
138 "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$" 138 "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
139 year month day)))) 139 year month day))))
140 140
141(defun org-datetree--find-create (regex year &optional month day insert) 141(defun org-datetree--find-create
142 "Find the datetree matched by REGEX for YEAR, MONTH, or DAY. 142 (regex-template year &optional month day insert)
143REGEX is passed to `format' with YEAR, MONTH, and DAY as 143 "Find the datetree matched by REGEX-TEMPLATE for YEAR, MONTH, or DAY.
144REGEX-TEMPLATE is passed to `format' with YEAR, MONTH, and DAY as
144arguments. Match group 1 is compared against the specified date 145arguments. Match group 1 is compared against the specified date
145component. If INSERT is non-nil and there is no match then it is 146component. If INSERT is non-nil and there is no match then it is
146inserted into the buffer." 147inserted into the buffer."
147 (when (or month day) 148 (when (or month day)
148 (org-narrow-to-subtree)) 149 (org-narrow-to-subtree))
149 (let ((re (format regex year month day)) 150 (let ((re (format regex-template year month day))
150 match) 151 match)
151 (goto-char (point-min)) 152 (goto-char (point-min))
152 (while (and (setq match (re-search-forward re nil t)) 153 (while (and (setq match (re-search-forward re nil t))
diff --git a/lisp/org/org-pcomplete.el b/lisp/org/org-pcomplete.el
index 49983c40a52..cf272de90a8 100644
--- a/lisp/org/org-pcomplete.el
+++ b/lisp/org/org-pcomplete.el
@@ -49,10 +49,10 @@
49 "Examine the thing at point and let the caller know what it is. 49 "Examine the thing at point and let the caller know what it is.
50The return value is a string naming the thing at point." 50The return value is a string naming the thing at point."
51 (let ((beg1 (save-excursion 51 (let ((beg1 (save-excursion
52 (skip-chars-backward "[:alnum:]-_@") 52 (skip-chars-backward "-[:alnum:]_@")
53 (point))) 53 (point)))
54 (beg (save-excursion 54 (beg (save-excursion
55 (skip-chars-backward "a-zA-Z0-9-_:$") 55 (skip-chars-backward "-a-zA-Z0-9_:$")
56 (point))) 56 (point)))
57 (line-to-here (buffer-substring (point-at-bol) (point)))) 57 (line-to-here (buffer-substring (point-at-bol) (point))))
58 (cond 58 (cond
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 0b6008a5114..73b55e29a5a 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -1884,7 +1884,7 @@ or as help on variables `cperl-tips', `cperl-problems',
1884;;Point is at start of real comment." 1884;;Point is at start of real comment."
1885;; (let ((c (current-column)) target cnt prevc) 1885;; (let ((c (current-column)) target cnt prevc)
1886;; (if (= c comment-column) nil 1886;; (if (= c comment-column) nil
1887;; (setq cnt (skip-chars-backward "[ \t]")) 1887;; (setq cnt (skip-chars-backward " \t"))
1888;; (setq target (max (1+ (setq prevc 1888;; (setq target (max (1+ (setq prevc
1889;; (current-column))) ; Else indent at comment column 1889;; (current-column))) ; Else indent at comment column
1890;; comment-column)) 1890;; comment-column))
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index f1ec5ceea56..4d91da73340 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1908,7 +1908,7 @@ the same column as the current line."
1908 (save-match-data 1908 (save-match-data
1909 (when (looking-at "\\s-*\\_<while\\_>") 1909 (when (looking-at "\\s-*\\_<while\\_>")
1910 (if (save-excursion 1910 (if (save-excursion
1911 (skip-chars-backward "[ \t\n]*}") 1911 (skip-chars-backward " \t\n}")
1912 (looking-at "[ \t\n]*}")) 1912 (looking-at "[ \t\n]*}"))
1913 (save-excursion 1913 (save-excursion
1914 (backward-list) (forward-symbol -1) (looking-at "\\_<do\\_>")) 1914 (backward-list) (forward-symbol -1) (looking-at "\\_<do\\_>"))
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index e49144e2900..9e3be99af14 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -894,7 +894,7 @@ Return non-nil if we skipped over matched tags."
894 (condition-case err 894 (condition-case err
895 (save-excursion 895 (save-excursion
896 (goto-char end) 896 (goto-char end)
897 (skip-chars-backward "[:alnum:]-_.:") 897 (skip-chars-backward "-[:alnum:]_.:")
898 (if (and ;; (<= (point) beg) ; This poses problems for downcase-word. 898 (if (and ;; (<= (point) beg) ; This poses problems for downcase-word.
899 (or (eq (char-before) ?<) 899 (or (eq (char-before) ?<)
900 (and (eq (char-before) ?/) 900 (and (eq (char-before) ?/)
@@ -902,7 +902,7 @@ Return non-nil if we skipped over matched tags."
902 (null (get-char-property (point) 'text-clones))) 902 (null (get-char-property (point) 'text-clones)))
903 (let* ((endp (eq (char-before) ?/)) 903 (let* ((endp (eq (char-before) ?/))
904 (cl-start (point)) 904 (cl-start (point))
905 (cl-end (progn (skip-chars-forward "[:alnum:]-_.:") (point))) 905 (cl-end (progn (skip-chars-forward "-[:alnum:]_.:") (point)))
906 (match 906 (match
907 (if endp 907 (if endp
908 (when (sgml-skip-tag-backward 1) (forward-char 1) t) 908 (when (sgml-skip-tag-backward 1) (forward-char 1) t)
@@ -919,7 +919,8 @@ Return non-nil if we skipped over matched tags."
919 (equal (buffer-substring cl-start cl-end) 919 (equal (buffer-substring cl-start cl-end)
920 (buffer-substring (point) 920 (buffer-substring (point)
921 (save-excursion 921 (save-excursion
922 (skip-chars-forward "[:alnum:]-_.:") 922 (skip-chars-forward
923 "-[:alnum:]_.:")
923 (point)))) 924 (point))))
924 (or (not endp) (eq (char-after cl-end) ?>))) 925 (or (not endp) (eq (char-after cl-end) ?>)))
925 (when clones 926 (when clones
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index 8c6e23eae4a..e960e992a89 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -642,7 +642,7 @@ appears in the texinfo file."
642 "Return description field of old menu line as string. 642 "Return description field of old menu line as string.
643Point must be located just after the node name. Point left before description. 643Point must be located just after the node name. Point left before description.
644Single argument, END-OF-MENU, is position limiting search." 644Single argument, END-OF-MENU, is position limiting search."
645 (skip-chars-forward "[:.,\t\n ]+") 645 (skip-chars-forward ":.,\t\n ")
646 ;; don't copy a carriage return at line beginning with asterisk! 646 ;; don't copy a carriage return at line beginning with asterisk!
647 ;; don't copy @detailmenu or @end menu or @ignore as descriptions! 647 ;; don't copy @detailmenu or @end menu or @ignore as descriptions!
648 ;; do copy a description that begins with an `@'! 648 ;; do copy a description that begins with an `@'!
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 46baa8a1482..1fbc0870737 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -517,7 +517,7 @@ Return the number of characters removed."
517 (setq url-http-response-version 517 (setq url-http-response-version
518 (buffer-substring (point) 518 (buffer-substring (point)
519 (progn 519 (progn
520 (skip-chars-forward "[0-9].") 520 (skip-chars-forward "0-9.")
521 (point)))) 521 (point))))
522 (setq url-http-response-status (read (current-buffer)))) 522 (setq url-http-response-status (read (current-buffer))))
523 523