link-hint.el icon indicating copy to clipboard operation
link-hint.el copied to clipboard

link-hint--apply: Attempt to improve the condition-case madness

Open stepnem opened this issue 4 years ago • 1 comments

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

stepnem avatar Mar 27 '20 01:03 stepnem

Catching the specific error is better. This wouldn't work for a function that takes a list as a single argument though.

noctuid avatar Mar 31 '20 23:03 noctuid