emacs-devel
[Top][All Lists]
Advanced

[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".





reply via email to

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