link-hint turns all errors from browse-url into wrong-number-of-arguments
Opened this issue · 0 comments
bcc32 commented
When browse-url-browser-function
signals an error, link-hint-open-link
and related commands replace the error with a wrong-number-of-arguments error, due to link-hint--apply
calling the function several times with different numbers of arguments.
This seems to be due to a desire to accommodate different calling conventions, but I think link-hint--apply
should only check for wrong-number-of-arguments
, not just any error.
For example, evaluating the following code:
;; https://google.com/
(let ((browse-url-browser-function
(lambda (url &rest args)
(error "Failed to start browser: %S" url))))
(call-interactively 'link-hint-open-link))
Causes this error:
Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 1) 0)
browse-url()
funcall(browse-url)
(condition-case nil (funcall func args) (error (funcall func)))
(condition-case nil (apply func args) (error (condition-case nil (funcall func args) (error (funcall func)))))
link-hint--apply(browse-url "https://google.com/" link-hint--process-url :open)
...
whereas the expected error is:
Failed to start browser: "https://google.com/"