From 99b6274b035bf75ea2b632bd0f2c7220d3e52c63 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 6 Jul 2017 17:45:11 +0200 Subject: [PATCH] New command: doom/other-popup #141 Like other-window, but for doom popups. Also bound this to `C-x p` in private module. --- core/autoload/popups.el | 16 ++++++++++++++++ modules/private/hlissner/+bindings.el | 3 +++ 2 files changed, 19 insertions(+) diff --git a/core/autoload/popups.el b/core/autoload/popups.el index 42b532472..d0824d478 100644 --- a/core/autoload/popups.el +++ b/core/autoload/popups.el @@ -189,3 +189,19 @@ only close popups that have an :autoclose property in their rule (see collect `(set! :popup ,@rule)) ,@body (setq shackle-rules old-shackle-rules))) + +;;;###autoload +(defun doom/other-popup (count) + "Cycle through popup windows. Like `other-window', but for popups." + (interactive "p") + (if-let (popups (if (doom-popup-p) + (cdr (memq (selected-window) doom-popup-windows)) + (setq doom-popup-other-window (selected-window)) + doom-popup-windows)) + (select-window (nth (mod (1- count) (length popups)) popups)) + (unless (eq (selected-window) doom-popup-other-window) + (when doom-popup-other-window + (select-window doom-popup-other-window t) + (cl-decf count)) + (when (/= count 0) + (other-window count))))) diff --git a/modules/private/hlissner/+bindings.el b/modules/private/hlissner/+bindings.el index 9a8896f52..2412b1073 100644 --- a/modules/private/hlissner/+bindings.el +++ b/modules/private/hlissner/+bindings.el @@ -66,6 +66,9 @@ :m "A-j" #'+hlissner:multi-next-line :m "A-k" #'+hlissner:multi-previous-line + (:prefix "C-x" + "p" #'doom/other-popup) + ;; --- ------------------------------------- (:leader