branch: externals/vertico commit 3be2c3c8d2857f631c605efe635f3450c39375cf Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
vertico--protect: Use handler-bind on Emacs 30 --- vertico.el | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/vertico.el b/vertico.el index 2a7d08c498..ab520760b0 100644 --- a/vertico.el +++ b/vertico.el @@ -481,14 +481,18 @@ The value should lie between 0 and vertico-count/2." "Protect FUN such that errors are caught. If an error occurs, the FUN is retried with `debug-on-error' enabled and the stack trace is shown in the *Messages* buffer." - (when (or debug-on-error (condition-case nil - (progn (funcall fun) nil) - (error t))) - (let ((debug-on-error t) - (debugger #'vertico--debug)) - (condition-case nil - (funcall fun) - ((debug error) nil))))) + (static-if (>= emacs-major-version 30) + (ignore-errors + (handler-bind ((error #'vertico--debug)) + (funcall fun))) + (when (or debug-on-error (condition-case nil + (progn (funcall fun) nil) + (error t))) + (let ((debug-on-error t) + (debugger #'vertico--debug)) + (condition-case nil + (funcall fun) + ((debug error) nil)))))) (defun vertico--exhibit () "Exhibit completion UI."