diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2025-05-16 18:04:01 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2025-05-16 18:04:01 +0200 |
| commit | 52b6c0ec4903a87f905ec8ee547a77f28196502d (patch) | |
| tree | 379847de81f1a4ba058aec39a854a6323aa44257 /corfu.el | |
| parent | 6b1a223ddbfabdfda048ea4c2c13182453e1cb68 (diff) | |
corfu--protect: Use handler-bind on Emacs 30
Diffstat (limited to 'corfu.el')
| -rw-r--r-- | corfu.el | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -868,14 +868,18 @@ the last command must be listed in `corfu-continue-commands'." "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 #'corfu--debug)) - (condition-case nil - (funcall fun) - ((debug error) nil))))) + (static-if (>= emacs-major-version 30) + (ignore-errors + (handler-bind ((error #'corfu--debug)) + (funcall fun))) + (when (or debug-on-error (condition-case nil + (progn (funcall fun) nil) + (error t))) + (let ((debug-on-error t) + (debugger #'corfu--debug)) + (condition-case nil + (funcall fun) + ((debug error) nil)))))) (defun corfu--post-command () "Refresh Corfu after last command." |
