From: Eli Zaretskii <eliz@gnu.org>
To: vibhavp@gmail.com
Cc: emacs-devel@gnu.org
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 [thread overview]
Message-ID: <83d22sxgct.fsf@gnu.org> (raw)
In-Reply-To: <87d22s16dl.fsf@gmail.com>
> From: vibhavp@gmail.com
> Date: Sat, 25 Apr 2015 22:40:14 +0530
> Cc: emacs-devel@gnu.org
>
> 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.
next prev parent reply other threads:[~2015-04-25 17:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-24 17:54 [PATCH] Fix browse-url not working when browse-url-browser-function is a list (regexp . function) pairs vibhavp
2015-04-25 16:14 ` vibhavp
2015-04-25 16:28 ` Eli Zaretskii
2015-04-25 17:10 ` vibhavp
2015-04-25 17:33 ` Eli Zaretskii [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-04-25 17:47 vibhavp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83d22sxgct.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=vibhavp@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.