Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link-hint turns all errors from browse-url into wrong-number-of-arguments #224

Open
bcc32 opened this issue Mar 21, 2024 · 0 comments · May be fixed by #225
Open

link-hint turns all errors from browse-url into wrong-number-of-arguments #224

bcc32 opened this issue Mar 21, 2024 · 0 comments · May be fixed by #225

Comments

@bcc32
Copy link
Contributor

bcc32 commented Mar 21, 2024

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/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant