emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c3f986a 1/2: Suppress errors of tab-line-switch functions


From: Juri Linkov
Subject: master c3f986a 1/2: Suppress errors of tab-line-switch functions
Date: Wed, 9 Sep 2020 15:30:45 -0400 (EDT)

branch: master
commit c3f986a4557b8785e16daf84f94c029b89c9feff
Author: Kiso Katsuyuki <katsuyuki2388@gmail.com>
Commit: Juri Linkov <juri@linkov.net>

    Suppress errors of tab-line-switch functions
    
    Traget errors occurs when tab-line-switch-to-prev-tab or
    tab-line-switch-to-next-tab is invoked in a buffer which is not in
    tabs
    
    Copyright-paperwork-exempt: yes
---
 lisp/tab-line.el | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 40f8095..140ee8c 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -652,13 +652,13 @@ Its effect is the same as using the `previous-buffer' 
command
         (switch-to-prev-buffer window)
       (with-selected-window (or window (selected-window))
         (let* ((tabs (funcall tab-line-tabs-function))
-               (tab (nth (1- (seq-position
-                              tabs (current-buffer)
-                              (lambda (tab buffer)
-                                (if (bufferp tab)
-                                    (eq buffer tab)
-                                  (eq buffer (cdr (assq 'buffer tab)))))))
-                         tabs))
+               (pos (seq-position
+                     tabs (current-buffer)
+                     (lambda (tab buffer)
+                       (if (bufferp tab)
+                           (eq buffer tab)
+                         (eq buffer (cdr (assq 'buffer tab)))))))
+               (tab (if pos (nth (1- pos) tabs)))
                (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab)))))
           (when (bufferp buffer)
             (switch-to-buffer buffer)))))))
@@ -673,13 +673,13 @@ Its effect is the same as using the `next-buffer' command
         (switch-to-next-buffer window)
       (with-selected-window (or window (selected-window))
         (let* ((tabs (funcall tab-line-tabs-function))
-               (tab (nth (1+ (seq-position
-                              tabs (current-buffer)
-                              (lambda (tab buffer)
-                                (if (bufferp tab)
-                                    (eq buffer tab)
-                                  (eq buffer (cdr (assq 'buffer tab)))))))
-                         tabs))
+               (pos (seq-position
+                     tabs (current-buffer)
+                     (lambda (tab buffer)
+                       (if (bufferp tab)
+                           (eq buffer tab)
+                         (eq buffer (cdr (assq 'buffer tab)))))))
+               (tab (if pos (nth (1+ pos) tabs)))
                (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab)))))
           (when (bufferp buffer)
             (switch-to-buffer buffer)))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]