fix: Enable syd-repl-mode /before/ displaying the buffer
This ensures that display-buffer-alist predicates can test for repl buffers.
This commit is contained in:
@@ -53,9 +53,39 @@ are active.")
|
||||
(evil-define-key* syd-alt-leader-key-states map (kbd syd-alt-leader-key) 'syd/leader))
|
||||
(general-override-mode 1))
|
||||
|
||||
(defvar syd-escape-hook nil
|
||||
"A hook run when C-g is pressed (or ESC in normal mode, for evil users).
|
||||
|
||||
More specifically, when `syd/escape' is pressed. If any hook returns non-nil,
|
||||
all hooks after it are ignored.")
|
||||
|
||||
(defun syd/escape (&optional interactive)
|
||||
"Run `syd-escape-hook'."
|
||||
(interactive (list 'interactive))
|
||||
(let ((inhibit-quit t))
|
||||
(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 'syd-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)))))))
|
||||
|
||||
|
||||
(with-eval-after-load 'eldoc
|
||||
(eldoc-add-command 'syd/escape))
|
||||
|
||||
(defun syd-keybinds-initialise ()
|
||||
(syd--initialise-leader)
|
||||
|
||||
(global-set-key [remap keyboard-quit] #'syd/escape)
|
||||
|
||||
;; Buffer
|
||||
(require 'syd-buffers)
|
||||
(general-def
|
||||
|
||||
Reference in New Issue
Block a user