link-hint.el
link-hint.el copied to clipboard
link-hint--apply: Attempt to improve the condition-case madness
There is func-arity' (since Emacs 26.1; there was only
subr-arity'
before that), but instead of trying to parse and deal with all
possible arity implications, simplify the logic to the following:
- if ARGS is a list, leave it alone and use `apply'
- if it is a non-list, wrap it in a list and use `apply'
- instead of catching all errors and breaking in all kinds of unexpected ways (e.g. when FUNC signals an unrelated but legitimate error), handle only `wrong-number-of-arguments', for cases where FUNC doesn't want any
Catching the specific error is better. This wouldn't work for a function that takes a list as a single argument though.