summaryrefslogtreecommitdiffstats
path: root/lisp/term
diff options
context:
space:
mode:
authorRavi R Kiran <aine.marina@gmail.com>2021-05-10 02:44:23 (GMT)
committerRavi R Kiran <aine.marina@gmail.com>2021-05-10 02:44:23 (GMT)
commit588b676a0d6e4cacd30810239e6924128c102198 (patch)
tree19505161c06ba59588d7d36b73ffaa6e13b5fa50 /lisp/term
parentcc0fe1d30b5b9da44f003f9658fccf52e52b4a8c (diff)
downloaddotemacs-588b676a0d6e4cacd30810239e6924128c102198.zip
dotemacs-588b676a0d6e4cacd30810239e6924128c102198.tar.gz
dotemacs-588b676a0d6e4cacd30810239e6924128c102198.tar.bz2
Run focus advice only once
It'd be nice to make it coexist with multiple terminal types, but don't know how to do it yet.
Diffstat (limited to 'lisp/term')
-rw-r--r--lisp/term/xterm-kitty.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/term/xterm-kitty.el b/lisp/term/xterm-kitty.el
index 9706fbb..bc65e6d 100644
--- a/lisp/term/xterm-kitty.el
+++ b/lisp/term/xterm-kitty.el
@@ -456,12 +456,19 @@ function is almost equivalent to 'event-convert-list'."
(when (xterm-kitty-in-use)
;; Terminal emacs thinks that only one frame is ever visible
(funcall old-function window minibuf (if (eql all-frames 'visible) t all-frames))))
-(defun xterm-kitty-add-select-frame-set-input-focus-advice ()
+
+(defvar xterm-kitty--skip-select-frame-set-input-focus-advice nil
+ "Set to true to disable setting input focus advice")
+(defun xterm-kitty-add-select-frame-set-input-focus-advice (&optional print-message)
"Advise SELECT-FRAME-SET-INPUT-FOCUS to handle xterm-kitty terminal windows"
- (interactive)
- (advice-add 'select-frame-set-input-focus :around #'xterm-kitty-select-frame-set-input-focus-advice)
- (advice-add 'next-window :around #'xterm-kitty-visible-window-advice)
- (advice-add 'previous-window :around #'xterm-kitty-visible-window-advice))
+ (interactive "p")
+ (if xterm-kitty--skip-select-frame-set-input-focus-advice
+ (when print-message
+ (message "Input focus advice for selecting frames disabled"))
+ (advice-add 'select-frame-set-input-focus :around #'xterm-kitty-select-frame-set-input-focus-advice)
+ (advice-add 'next-window :around #'xterm-kitty-visible-window-advice)
+ (advice-add 'previous-window :around #'xterm-kitty-visible-window-advice)
+ (setq xterm-kitty--skip-select-frame-set-input-focus-advice t)))
(defvar xterm-kitty--new-os-window-command-string
"\eP@kitty-cmd{\"cmd\":\"new-window\",\"version\":[0,19,3],\"no_response\":true,\"payload\":{\"window_type\":\"os\"}}\e\\"