Function: corfu--protect

corfu--protect is a byte-compiled function defined in corfu.el.

Signature

(corfu--protect FUN)

Documentation

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.

Source Code

;; Defined in ~/.emacs.d/elpa/corfu-20260813.950/corfu.el
(defun corfu--protect (fun)
  "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."
  (static-if (fboundp 'handler-bind) ;; Available on Emacs 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))))))