summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-08-12 17:51:51 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-08-12 17:51:51 -0700
commitc1eb12d023d2fe0ff2c996e4b06ded93de851f26 (patch)
treebc10f35847e57bfa7edd230fff7451d99fe4cafe
parent92273fd7f9fc83f943117e0e044c22aa433e6447 (diff)
downloaddotfiles-c1eb12d023d2fe0ff2c996e4b06ded93de851f26.tar.gz
factor out spw/tabs-without-current
-rw-r--r--.emacs.d/init-spw.el18
1 files changed, 9 insertions, 9 deletions
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el
index 86c16a2d..df659d7e 100644
--- a/.emacs.d/init-spw.el
+++ b/.emacs.d/init-spw.el
@@ -724,6 +724,10 @@ add places the library might be available to `load-path'."
tab-bar-new-button-show nil
tab-bar-close-button-show nil)
;; this makes C-x t o like my (customised) C-x o
+(defun spw/tabs-without-current ()
+ (cl-remove-if (lambda (tab)
+ (eq (car tab) 'current-tab))
+ (funcall tab-bar-tabs-function)))
(let (recent-tab-old-time)
(defun spw/tab-bar-switch-to-recent-tab ()
(interactive)
@@ -734,9 +738,7 @@ add places the library might be available to `load-path'."
(setq recent-tab-old-time
(apply #'min
(mapcar (lambda (tab) (alist-get 'time tab))
- (cl-remove-if (lambda (tab)
- (eq (car tab) 'current-tab))
- (funcall tab-bar-tabs-function)))))
+ (spw/tabs-without-current))))
(call-interactively #'tab-bar-switch-to-recent-tab))
(spw/bind-command-with-cycling
([remap tab-next] . spw/tab-bar-switch-to-recent-tab)
@@ -753,12 +755,10 @@ add places the library might be available to `load-path'."
(length tabs))))
(alist-get 'time (nth new-index tabs)))))
(tab-bar-switch-to-next-tab count)
- (setf (alist-get
- 'time
- (car (seq-sort-by (lambda (tab) (alist-get 'time tab)) #'>
- (seq-remove (lambda (tab)
- (eq (car tab) 'current-tab))
- (funcall tab-bar-tabs-function)))))
+ (setf (alist-get 'time (car (seq-sort-by (lambda (tab)
+ (alist-get 'time tab))
+ #'>
+ (spw/tabs-without-current))))
recent-tab-old-time)
(setq recent-tab-old-time next-tab-old-time)))))