summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-08-14 15:13:51 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-08-14 15:13:51 -0700
commit581f3e2cbb1b6453e28acc9bc9e428db22a835e8 (patch)
tree832486423d83b250eb301261fa805ea7babfaaad
parentd38e731e7abcd2f82bba3381cfe9232c71cbb8ac (diff)
downloaddotfiles-581f3e2cbb1b6453e28acc9bc9e428db22a835e8.tar.gz
bind C-c t left/right and C-c t o
-rw-r--r--.emacs.d/init-spw.el18
1 files changed, 15 insertions, 3 deletions
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el
index a8a2aba7..575d36e7 100644
--- a/.emacs.d/init-spw.el
+++ b/.emacs.d/init-spw.el
@@ -739,7 +739,7 @@ add places the library might be available to `load-path'."
(eq (car tab) 'current-tab))
(funcall tab-bar-tabs-function)))
(let (recent-tab-old-time)
- (defun spw/tab-bar-switch-to-recent-tab ()
+ (defun spw/tab-bar-switch-with-record (fn &rest args)
(interactive)
(when-let ((tabs (spw/tabs-without-current)))
;; If the most recent tab is not the one we end up at after exiting the
@@ -748,9 +748,21 @@ add places the library might be available to `load-path'."
;; record that info so we can do that.
(setq recent-tab-old-time
(apply #'min (mapcar (lambda (tab) (alist-get 'time tab)) tabs)))
- (call-interactively #'tab-bar-switch-to-recent-tab)))
+ (apply fn args)))
+ (defun spw/tab-prev (n)
+ (interactive "p")
+ (spw/tab-next (* -1 n)))
+ (defun spw/tab-bar-switch-to-recent-tab ()
+ (interactive)
+ (spw/tab-bar-switch-with-record #'tab-bar-switch-to-recent-tab))
+ (defun spw/tab-next (n)
+ (interactive "p")
+ (spw/tab-bar-switch-with-record #'tab-bar-switch-to-next-tab n))
(spw/bind-command-with-cycling
- ([remap tab-next] . spw/tab-bar-switch-to-recent-tab)
+ (([?\C-c ?t left] . spw/tab-prev)
+ ([?\C-c ?t ?o] . spw/tab-bar-switch-to-recent-tab)
+ ([remap tab-next] . spw/tab-bar-switch-to-recent-tab)
+ ([?\C-c ?t right] . spw/tab-next))
(lambda (count)
(interactive "p")
;; We are moving away from the current tab, so restore its time as if we