emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: url library and GnuTLS, and Emacs-issued certificates


From: Reiner Steib
Subject: Re: url library and GnuTLS, and Emacs-issued certificates
Date: Mon, 28 Mar 2011 08:51:25 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.1 (gnu/linux)

On Sat, Mar 26 2011, Ted Zlatanov wrote:

> On Sat, 26 Mar 2011 Reiner Steib <address@hidden> wrote: 
> RS> On Sat, Mar 26 2011, Ted Zlatanov wrote:
>>> -  `(let* ((http (string-match "\\`http:" ,location))
>>> +  `(let* ((http (string-match "\\`\\(https\\|http\\):" ,location))
>
> RS> -  `(let* ((http (string-match "\\`http:" ,location))
> RS> +  `(let* ((http (string-match "\\`https?:" ,location))
>
> (I *knew* I'd have to explain it :)
>
> It's rarely used so I wasn't worried about optimizing it.  

I didn't think about optimizing neither.  Though regexp-opt suggests
that "https?" is preferable:

    ELISP> (regexp-opt '("http" "https"))
    "https?"

> Showing both versions in an alternation makes it easier to see both
> schemes are supported at a glance.

I think "https?" also makes this clear and it is more readable -
especially since it doesn't require unnecessary grouping.

BTW:

emacs/lisp$ grep -e 'http[\\].*https' -e 'https[\\].*http' *.el */*.el|wc -l
1
emacs/lisp$ grep -e 'https[?]' *.el */*.el|wc -l
12

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



reply via email to

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