Skip to content

Commit

Permalink
tweak(core): exit minibuffer from anywhere using S-ESC
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Nov 17, 2023
1 parent c033b65 commit 070a9bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/me-keybindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@
(when (executable-find "ecryptfs-verify")
(+map! "te" #'ecryptfs-toggle-mount-private)))

;; Exit minibuffer from anywhere
(keymap-global-set "S-<escape>" #'+minibuffer-kill-minibuffer)

;; HACK: This is a synchronization feature, providing `me-general-ready' tells
;; the `+map!', `+map-local!', ... macros that `general' is ready and the
;; definers `+minemacs--internal-map!', `+minemacs--internal-map-local!', ...
Expand Down
9 changes: 9 additions & 0 deletions elisp/+emacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ prefix or universal argument, it waits for a moment (defined by
(when (stringp outfile) (copy-file tmp-file outfile))
(message "Screenshot saved to %s" (or outfile tmp-file))))

;; Kill the minibuffer even when in another windown.
;; Adapted from: trey-jackson.blogspot.com/2010/04/emacs-tip-36-abort-minibuffer-when.html
;;;###autoload
(defun +minibuffer-kill-minibuffer ()
"Kill the minibuffer when switching to window with mouse."
(interactive)
(when (and (>= (recursion-depth) 1) (active-minibuffer-window))
(abort-recursive-edit)))

;;;###autoload
(defun +region-or-thing-at-point ()
"Return the region or the thing at point."
Expand Down

0 comments on commit 070a9bd

Please sign in to comment.