diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-08-12 21:10:25 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-08-12 21:10:25 -0700 |
commit | 4d45cc6c74f722cf80560bf5d99ca1b2d383b1b3 (patch) | |
tree | a6fdf4ceeaf56cbfd1df48a7fbaa139d5323ac8d | |
parent | 0864ea6289e5bb33d1efd4b3098dbd3590b2984a (diff) | |
download | dotfiles-4d45cc6c74f722cf80560bf5d99ca1b2d383b1b3.tar.gz |
avoid calling min on an empty list
-rw-r--r-- | .emacs.d/init-spw.el | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el index 81f05e14..7900a6ad 100644 --- a/.emacs.d/init-spw.el +++ b/.emacs.d/init-spw.el @@ -741,15 +741,14 @@ add places the library might be available to `load-path'." (let (recent-tab-old-time) (defun spw/tab-bar-switch-to-recent-tab () (interactive) - ;; If the most recent tab is not the one we end up at after exiting the - ;; transient map, we will want to set that tab's time back to what it was - ;; before we changed tabs, as if we had never selected it. So record that - ;; info so we can do that. - (setq recent-tab-old-time - (apply #'min - (mapcar (lambda (tab) (alist-get 'time tab)) - (spw/tabs-without-current)))) - (call-interactively #'tab-bar-switch-to-recent-tab)) + (when-let ((tabs (spw/tabs-without-current))) + ;; If the most recent tab is not the one we end up at after exiting the + ;; transient map, we will want to set that tab's time back to what it + ;; was before we changed tabs, as if we had never selected it. So + ;; 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))) (spw/bind-command-with-cycling ([remap tab-next] . spw/tab-bar-switch-to-recent-tab) (lambda (count) |