Function: majutsu--transient--do-quit-one-dwim

majutsu--transient--do-quit-one-dwim is a natively compiled function defined in majutsu-core.el.

Signature

(majutsu--transient--do-quit-one-dwim ORIG-FN &rest ARGS)

Documentation

Advice around transient--do-quit-one for Majutsu transients.

If the user presses <escape> or C-g while in Evil visual state, then exit visual state and keep the transient. Otherwise quit as usual.

Note: <escape> does not affect the plain Emacs region.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-core.el
(defun majutsu--transient--do-quit-one-dwim (orig-fn &rest args)
  "Advice around `transient--do-quit-one' for Majutsu transients.

If the user presses <escape> or C-g while in Evil visual state, then
exit visual state and keep the transient.  Otherwise quit as usual.

Note: <escape> does not affect the plain Emacs region."
  (let ((event (majutsu--transient--quit-event)))
    (cond
     ((and (majutsu--transient--majutsu-prefix-p)
           (memq event '(escape ?\C-g))
           (majutsu--transient--selection-active-p))
      (majutsu--transient--cancel-selection)
      t)
     ((and (majutsu--transient--majutsu-prefix-p)
           (eq event ?\C-g)
           (use-region-p))
      (deactivate-mark)
      t)
     (t
      (apply orig-fn args)))))