Function: transient--quit-kludge

transient--quit-kludge is a byte-compiled function defined in transient.el.

Signature

(transient--quit-kludge ACTION)

Source Code

;; Defined in ~/.emacs.d/elpa/transient-20260414.1009/transient.el
(defun transient--quit-kludge (action)
  ;; Fixing the bug that makes this kludge necessary was proposed in
  ;; https://yhetil.org/emacs-bugs/m1ikl4iqtg.fsf@dancol.org/, but it
  ;; does not look like that's gonna be merged any time soon.  See also
  ;; https://github.com/magit/transient/commit/45fbefdc5b112f0a15cd9365.
  (static-if (boundp 'redisplay-can-quit)
      action
    (pcase-exhaustive action
      ('enable
       (add-function
        :around command-error-function
        (let (unreadp)
          (lambda (orig data context fn)
            (cond ((not (eq (car data) 'quit))
                   (funcall orig data context fn)
                   (setq unreadp nil))
                  (unreadp
                   (remove-function command-error-function "inhibit-quit")
                   (funcall orig data context fn))
                  (t
                   (push ?\C-g unread-command-events)
                   (setq unreadp t)))))
        '((name . "inhibit-quit"))))
      ('disable
       (remove-function command-error-function "inhibit-quit")))))