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

Re: Can't load w3m when browse-url-browser-function had been set before



In [emacs-w3m : No.12317]
	On Tue, 10 Jun 2014 15:36:40 +0200, Michael Heerdegen wrote:
> Consider the following definitions in a user's init file (in this
> order):

> (add-to-list 'load-path "/path/to/w3m/dir/")
> (setq browse-url-browser-function
>       #'my-w3m-browse-url-new-session)
> (require 'w3m)
> (defun my-w3m-browse-url-new-session (url &rest _)
>   (code ...))

> When you evaluate this from emacs -Q in this order, you get this error:

> Debugger entered--Lisp error: (wrong-type-argument listp my-w3m-browse-url-new-session)
>   caar(my-w3m-browse-url-new-session)

[...]

> Indeed, this part of the definition of w3m-content-type-alist is a bit
> unlucky:

>     (if (functionp browse-url-browser-function)
>         (symbol-value 'browse-url-browser-function)
>       (catch 'browser
>         (let ((alist browse-url-browser-function))
>           (while alist ...))))

> I guess it should better be something like

>     (if (symbolp browse-url-browser-function)
>         browse-url-browser-function
>       (catch 'browser
>         (let ((alist browse-url-browser-function))
>           (while alist ...))))

Thanks for tracking it down.  I've fixed it in CVS as follows:

(if (stringp (car-safe
              (car-safe browse-url-browser-function)))
    (catch 'browser
      ...)
  browse-url-browser-function)