[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scan of regexps in Emacs (March 17)
From: |
Mattias Engdegård |
Subject: |
Re: Scan of regexps in Emacs (March 17) |
Date: |
Tue, 19 Mar 2019 11:34:54 +0100 |
19 mars 2019 kl. 02.21 skrev Paul Eggert <address@hidden>:
>
> Thanks for doing that. I fixed all the regular expressions I could
> easily fix, by installing the attached patch into master.
Good work, comments below.
> I saw two false alarms, both in lisp/org/org-datetree.el. Both are of
> the form (re-search-forward (format "[chars%%]+" ...) nil t), in which
> both '%' characters are needed. Perhaps you could tweak the trawler to
> not report these?
If you could stomach some sophistry, I believe the Computer is Right here. The
argument to org-datetree--find-create is named REGEX, but these strings are not
regexps, merely templates for such. Thus, the argument is misnamed; by changing
it to REGEX-TEMPLATE, the complaint goes away.
(By the way, I was appalled to discover that `format' doesn't complain about
supernumerary arguments. Its (ab)use in this function indicates that it would
be hard to change that behaviour.)
> I assume this was a complete trawl, so that I can ignore the earlier
> scans you emailed (I got behind in looking into them). If not, please
> let me know.
Yes, it was complete.
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
...
(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 "\\\s")))
^^^^
The last argument is also a regexp. Presumably it should be just " ",
or did the author mean any horizontal whitespace?
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -513,7 +513,7 @@ Return the number of characters removed."
(url-http-debug "url-http-parse-response called in (%s)" (buffer-name))
(goto-char (point-min))
(skip-chars-forward " \t\n") ; Skip any blank crap
- (skip-chars-forward "HTTP/") ; Skip HTTP Version
+ (skip-chars-forward "/HPT") ; Skip HTTP Version "HTTP/".
It looks rather like the intention was to skip the very string "HTTP/",
but I suppose that will do. A few lines later:
(setq url-http-response-version
(buffer-substring (point)
(progn
(skip-chars-forward "[0-9].")
^^^^^^
This one should surely not include the brackets.
The HTTP response string is something like "HTTP/1.1 451 CENSORED".
- Scan of regexps in Emacs (March 17), Mattias Engdegård, 2019/03/17
- Re: Scan of regexps in Emacs (March 17), Paul Eggert, 2019/03/18
- Re: Scan of regexps in Emacs (March 17),
Mattias Engdegård <=
- Re: Scan of regexps in Emacs (March 17), Paul Eggert, 2019/03/19
- Re: Scan of regexps in Emacs (March 17), Stefan Monnier, 2019/03/19
- Re: Scan of regexps in Emacs (March 17), Paul Eggert, 2019/03/20
- RE: Scan of regexps in Emacs (March 17), Drew Adams, 2019/03/20
- Re: Scan of regexps in Emacs (March 17), Paul Eggert, 2019/03/20
- Re: Scan of regexps in Emacs (March 17), Eli Zaretskii, 2019/03/20
- RE: Scan of regexps in Emacs (March 17), Drew Adams, 2019/03/21
- Re: Scan of regexps in Emacs (March 17), Eli Zaretskii, 2019/03/21
- Re: Scan of regexps in Emacs (March 17), Stefan Monnier, 2019/03/20
- Re: Scan of regexps in Emacs (March 17), Mattias Engdegård, 2019/03/21