From aacd03db7e9694d70f670453de3f4ee5e694d8cb Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 23 Feb 2022 17:53:12 +0300 Subject: feat(tazjin/emacs): Add #'exwm-jump-to-buffer This allows me to jump to a workspace that is already displayed on some buffer. This also interfaces correctly with my back-and-forth jump functionality, setting the variables to allow quick jumping back to the previous buffer via the numerical index of the destination or - of course - via s-b. Change-Id: I25db7535089bcb17b3d61d53030b9154cfeac023 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5323 Tested-by: BuildkiteCI Reviewed-by: tazjin Autosubmit: tazjin --- users/tazjin/emacs/config/desktop.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'users/tazjin') diff --git a/users/tazjin/emacs/config/desktop.el b/users/tazjin/emacs/config/desktop.el index 094880a00870..2b50c4203933 100644 --- a/users/tazjin/emacs/config/desktop.el +++ b/users/tazjin/emacs/config/desktop.el @@ -219,6 +219,21 @@ in-progress." (exwm-input-set-key (kbd "s-f") #'switch-to-next-workspace) +;; Provide a binding for jumping to a buffer on a workspace. +(defun exwm-jump-to-buffer () + "Jump to a workspace on which the target buffer is displayed." + (interactive) + (let ((exwm-layout-show-all-buffers nil) + (initial exwm-workspace-current-index)) + (call-interactively #'exwm-workspace-switch-to-buffer) + ;; After jumping, update the back-and-forth list like on a direct + ;; index jump. + (when (not (eq initial exwm-workspace-current-index)) + (setq *exwm-workspace-from-to* + (cons initial exwm-workspace-current-index))))) + +(exwm-input-set-key (kbd "C-c j") #'exwm-jump-to-buffer) + ;; Launch applications / any command with completion (dmenu style!) (exwm-input-set-key (kbd "s-d") #'counsel-linux-app) (exwm-input-set-key (kbd "s-x") #'run-external-command) -- cgit 1.4.1