emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Fix browse-url not working when browse-url-browser-function


From: Eli Zaretskii
Subject: Re: [PATCH] Fix browse-url not working when browse-url-browser-function is a list (regexp . function) pairs
Date: Sat, 25 Apr 2015 20:33:38 +0300

> From: address@hidden
> Date: Sat, 25 Apr 2015 22:40:14 +0530
> Cc: address@hidden
> 
> However (for some reason), (car bf) returns (browser-function) instead
> of browse-function, which can be demonstrated with this piece of code:
> 
> (defun abc () 
>   (dolist (bf '(("i.imgur.com" browse-url-emacs)
>               ("youtube.com" browse-url-firefox)
>               ("." browse-url-chromium)))
>     (print (cdr bf))))

Shouldn't this be

(defun abc () 
  (dolist (bf '(("i.imgur.com" . browse-url-emacs)
                ("youtube.com" . browse-url-firefox)
                ("." . browse-url-chromium)))
    (print (cdr bf))))

instead?

> The output of this is:
> 
> (browse-url-emacs)
> 
> (browse-url-firefox)
> 
> (browse-url-chromium)
> 
> nil
> 
> This is not what we want, because applying (browse-url-emacs) to the URL
> results in an "invalid function" error.

Yes, because you used a list of lists instead of a list of conses,
like the doc string of browse-url-browser-function requires.

> If the "car" is replaced with a
> "cadr", this is the output:
> 
> "browse-url-emacs"
> 
> "browse-url-youtube"
> 
> "browse-url-chromium"
> 
> nil
> 
> This is the desired outcome.

But it will fail with a list of cons cells.



reply via email to

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