From: Kiso Katsuyuki <katsuyuki2388@gmail.com>
To: juri@linkov.net, emacs-devel@gnu.org
Subject: Re: tab-line-mode improvement
Date: Wed, 9 Sep 2020 01:48:49 -0500 [thread overview]
Message-ID: <CAOq35dhp0928p=5odwno3PUO1N36rmZwmYDMiacP67=-yBcoag@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 628 bytes --]
Thank you for your feedback!
>> +(defcustom tab-line-switch-cycling nil
>> + "Enable `tab-line-switch-to-next-tab',
>> + `tab-line-switch-to-prev-tab' cycling switch. If the value is t,
>> + the cycling switch is enabled. If the value is nil, it is disabled."
>
>The first line of the docstring should be a complete sentence
>as described in (info "(elisp) Documentation")
I changed the docstring to meet this rule. I also changed defcustom
keyword values for this variable.
I changed the Suppress... patch's commit comment so that the error
case becomes clearer.
Modified patches are attached.
Best regards,
Katsuyuki
[-- Attachment #1.2: Type: text/html, Size: 820 bytes --]
[-- Attachment #2: 0001-Introduce-a-new-variable-tab-line-switch-cycling.patch --]
[-- Type: text/x-patch, Size: 1988 bytes --]
From e4bedfb5a0f0ef12e54c0052d9b4d673937e1475 Mon Sep 17 00:00:00 2001
From: Kiso Katsuyuki <katsuyuki2388@gmail.com>
Date: Mon, 7 Sep 2020 17:14:09 -0500
Subject: [PATCH] Introduce a new variable tab-line-switch-cycling
If it is set t, enable cycling tab switch. Default is nil.
---
lisp/tab-line.el | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 3b4d3e68ad..23661c619a 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -659,7 +659,9 @@ tab-line-switch-to-prev-tab
(eq buffer tab)
(eq buffer (cdr (assq 'buffer tab)))))))
(tab (if pos
- (nth (1- pos) tabs)))
+ (if (and tab-line-switch-cycling (<= pos 0))
+ (nth (1- (length tabs)) tabs)
+ (nth (1- pos) tabs))))
(buffer (if (bufferp tab) tab (cdr (assq 'buffer tab)))))
(when (bufferp buffer)
(switch-to-buffer buffer)))))))
@@ -681,11 +683,22 @@ tab-line-switch-to-next-tab
(eq buffer tab)
(eq buffer (cdr (assq 'buffer tab)))))))
(tab (if pos
- (nth (1+ pos) tabs)))
+ (if (and tab-line-switch-cycling (<= (length tabs) (1+ pos)))
+ (car tabs)
+ (nth (1+ pos) tabs))))
(buffer (if (bufferp tab) tab (cdr (assq 'buffer tab)))))
(when (bufferp buffer)
(switch-to-buffer buffer)))))))
+(defcustom tab-line-switch-cycling nil
+ "Enable cycling tab switch.
+If non-nil, `tab-line-switch-to-prev-tab' in the first tab
+switches to the last tab and `tab-line-switch-to-next-tab' in the last
+tab swithces to the first tab."
+ :type 'boolean
+ :group 'tab-line
+ :version "28.1")
+
\f
(defcustom tab-line-close-tab-function 'bury-buffer
"Defines what to do on closing the tab.
--
2.28.0
[-- Attachment #3: 0001-Suppress-errors-of-tab-line-switch-functions.patch --]
[-- Type: text/x-patch, Size: 2686 bytes --]
From 741e05bff01b56efc0fd6f3166b5bbf6d30b1571 Mon Sep 17 00:00:00 2001
From: Kiso Katsuyuki <katsuyuki2388@gmail.com>
Date: Mon, 7 Sep 2020 16:01:46 -0500
Subject: [PATCH] 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
---
lisp/tab-line.el | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index e8c4dc4d93..3b4d3e68ad 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -652,13 +652,14 @@ tab-line-switch-to-prev-tab
(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 +674,14 @@ tab-line-switch-to-next-tab
(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)))))))
--
2.28.0
next reply other threads:[~2020-09-09 6:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 6:48 Kiso Katsuyuki [this message]
2020-09-09 19:31 ` tab-line-mode improvement Juri Linkov
2020-09-13 5:41 ` Kiso Katsuyuki
2020-09-13 13:24 ` Lars Ingebrigtsen
-- strict thread matches above, loose matches on Subject: below --
2020-09-10 4:51 Kiso Katsuyuki
2020-09-08 4:39 Kiso Katsuyuki
2020-09-08 18:56 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOq35dhp0928p=5odwno3PUO1N36rmZwmYDMiacP67=-yBcoag@mail.gmail.com' \
--to=katsuyuki2388@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.