dev: merging from main

This commit is contained in:
Matt Nish-Lapidus 2024-03-29 10:45:55 -04:00
commit f94083403d
496 changed files with 5618 additions and 6088 deletions

View file

@ -15,6 +15,12 @@
"An alternative leader prefix key, used for Insert and Emacs states, and for
non-evil users.")
(defvar doom-leader-key-states '(normal visual motion)
"which evil modes to activate the leader key for")
(defvar doom-leader-alt-key-states '(emacs insert)
"which evil modes to activate the alternative leader key for")
(defvar doom-localleader-key "SPC m"
"The localleader prefix key, for major-mode specific commands.")
@ -35,7 +41,7 @@ and Emacs states, and for non-evil users.")
;;; Global keybind settings
(cond
(IS-MAC
(doom--system-macos-p
;; mac-* variables are used by the special emacs-mac build of Emacs by
;; Yamamoto Mitsuharu, while other builds use ns-*.
(setq mac-command-modifier 'super
@ -45,18 +51,18 @@ and Emacs states, and for non-evil users.")
;; Free up the right option for character composition
mac-right-option-modifier 'none
ns-right-option-modifier 'none))
(IS-WINDOWS
(doom--system-windows-p
(setq w32-lwindow-modifier 'super
w32-rwindow-modifier 'super)))
;; HACK: Emacs cannot distinguish between C-i from TAB. This is largely a
;; byproduct of its history in the terminal, which can't distinguish them
;; either, however, when GUIs came about Emacs greated separate input events
;; either, however, when GUIs came about Emacs created separate input events
;; for more contentious keys like TAB and RET. Therefore [return] != RET,
;; [tab] != TAB, and [backspace] != DEL.
;;
;; In the same vein, this keybind adds a [C-i] event, so users can bind to it.
;; Otherwise, it falls back to regular C-i keybinds.
;; In the same vein, this keybind adds a [C-i] event, so users can bind to it
;; independently of TAB. Otherwise, it falls back to keys bound to C-i.
(define-key key-translation-map [?\C-i]
(cmd! (if (let ((keys (this-single-command-raw-keys)))
(and keys
@ -98,19 +104,20 @@ all hooks after it are ignored.")
(defun doom/escape (&optional interactive)
"Run `doom-escape-hook'."
(interactive (list 'interactive))
(cond ((minibuffer-window-active-p (minibuffer-window))
;; quit the minibuffer if open.
(when interactive
(setq this-command 'abort-recursive-edit))
(abort-recursive-edit))
;; Run all escape hooks. If any returns non-nil, then stop there.
((run-hook-with-args-until-success 'doom-escape-hook))
;; don't abort macros
((or defining-kbd-macro executing-kbd-macro) nil)
;; Back to the default
((unwind-protect (keyboard-quit)
(let ((inhibit-quit t))
(cond ((minibuffer-window-active-p (minibuffer-window))
;; quit the minibuffer if open.
(when interactive
(setq this-command 'keyboard-quit))))))
(setq this-command 'abort-recursive-edit))
(abort-recursive-edit))
;; Run all escape hooks. If any returns non-nil, then stop there.
((run-hook-with-args-until-success 'doom-escape-hook))
;; don't abort macros
((or defining-kbd-macro executing-kbd-macro) nil)
;; Back to the default
((unwind-protect (keyboard-quit)
(when interactive
(setq this-command 'keyboard-quit)))))))
(global-set-key [remap keyboard-quit] #'doom/escape)