* tab-line-mode improvement
@ 2020-09-08 4:39 Kiso Katsuyuki
2020-09-08 18:56 ` Juri Linkov
0 siblings, 1 reply; 7+ messages in thread
From: Kiso Katsuyuki @ 2020-09-08 4:39 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 518 bytes --]
Hi all,
I came up with two improvements on tab-line-mode:
1. Suppress-errors...
It suppresses errors when tab-line-switch-to-prev-tab or
tab-line-switch-to-next-tab is invoked in the window which has no tabs.
2. Introduce-a-new-variable... (after #1 patch is applied)
It introduces a new variable tab-line-switch-cycling which enables
cycling tab switch.
These patches are attached.
I sent patches for the first time, any advices, comments, or questions are
very welcome.
Best regards,
Katsuyuki
[-- Attachment #1.2: Type: text/html, Size: 678 bytes --]
[-- Attachment #2: 0001-Suppress-errors-of-tab-line-switch-functions.patch --]
[-- Type: text/x-patch, Size: 2685 bytes --]
From 13626c36efed39f89eb4c31af3cbc87fcd80f01f 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 the window which has no 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
[-- Attachment #3: 0001-Introduce-a-new-variable-tab-line-switch-cycling.patch --]
[-- Type: text/x-patch, Size: 2008 bytes --]
From 5936af79326e8d484d482ed9a9cc1a3d3dd90f49 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 switch cycling. Default is nil.
---
lisp/tab-line.el | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 3b4d3e68ad..2ad1b6a330 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,21 @@ 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 `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."
+ :type '(choice (const :tag "Disabled" nil)
+ (other :tag "Enabled" t))
+ :group 'tab-line)
+
\f
(defcustom tab-line-close-tab-function 'bury-buffer
"Defines what to do on closing the tab.
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: tab-line-mode improvement
2020-09-08 4:39 Kiso Katsuyuki
@ 2020-09-08 18:56 ` Juri Linkov
0 siblings, 0 replies; 7+ messages in thread
From: Juri Linkov @ 2020-09-08 18:56 UTC (permalink / raw)
To: Kiso Katsuyuki; +Cc: emacs-devel
> I came up with two improvements on tab-line-mode:
>
> 1 Suppress-errors...
> It suppresses errors when tab-line-switch-to-prev-tab or
> tab-line-switch-to-next-tab is invoked in the window which has no tabs.
> 2 Introduce-a-new-variable... (after #1 patch is applied)
> It introduces a new variable tab-line-switch-cycling which enables
> cycling tab switch.
Thanks, both patches are useful additions.
> These patches are attached.
> I sent patches for the first time, any advices, comments, or questions are
> very welcome.
It seems your patches are short enough that you don't need to sign papers
for patches to be accepted.
> +(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")
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: tab-line-mode improvement
@ 2020-09-09 6:48 Kiso Katsuyuki
2020-09-09 19:31 ` Juri Linkov
0 siblings, 1 reply; 7+ messages in thread
From: Kiso Katsuyuki @ 2020-09-09 6:48 UTC (permalink / raw)
To: juri, emacs-devel
[-- 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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: tab-line-mode improvement
2020-09-09 6:48 tab-line-mode improvement Kiso Katsuyuki
@ 2020-09-09 19:31 ` Juri Linkov
2020-09-13 5:41 ` Kiso Katsuyuki
0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2020-09-09 19:31 UTC (permalink / raw)
To: Kiso Katsuyuki; +Cc: emacs-devel
> 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.
Thank you for your patches, now pushed to master, after changing
tab characters to spaces - there no tabs in tab-line.el!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: tab-line-mode improvement
@ 2020-09-10 4:51 Kiso Katsuyuki
0 siblings, 0 replies; 7+ messages in thread
From: Kiso Katsuyuki @ 2020-09-10 4:51 UTC (permalink / raw)
To: juri, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 202 bytes --]
>Thank you for your patches, now pushed to master, after changing
>tab characters to spaces - there no tabs in tab-line.el!
Thank you applying the patches.
I understood there are no tabs in this file.
[-- Attachment #2: Type: text/html, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: tab-line-mode improvement
2020-09-09 19:31 ` Juri Linkov
@ 2020-09-13 5:41 ` Kiso Katsuyuki
2020-09-13 13:24 ` Lars Ingebrigtsen
0 siblings, 1 reply; 7+ messages in thread
From: Kiso Katsuyuki @ 2020-09-13 5:41 UTC (permalink / raw)
To: Juri Linkov, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 126 bytes --]
Sorry, I forgot to mention an exception in
tab-line-switch-cycling docstring.
The docstring modification patch is attached.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: New patch --]
[-- Type: text/x-patch, Size: 962 bytes --]
From 803adce8bbb5bc35e011afb6b1e57a9878525b03 Mon Sep 17 00:00:00 2001
From: Kiso Katsuyuki <katsuyuki2388@gmail.com>
Date: Sun, 13 Sep 2020 00:01:59 -0500
Subject: [PATCH] Just add exception to the docstring
tab-line-switch-cycling is not effective when
tab-line-tabs-window-buffers is used.
---
lisp/tab-line.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 108f9f7d99..ef73d589c1 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -646,7 +646,8 @@ using the `previous-buffer' command."
"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 switches to the first tab."
+last tab switches to the first tab. This variable is not effective
+when `tab-line-tabs-function' is `tab-line-tabs-window-buffers'"
:type 'boolean
:group 'tab-line
:version "28.1")
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: tab-line-mode improvement
2020-09-13 5:41 ` Kiso Katsuyuki
@ 2020-09-13 13:24 ` Lars Ingebrigtsen
0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 13:24 UTC (permalink / raw)
To: Kiso Katsuyuki; +Cc: emacs-devel, Juri Linkov
Kiso Katsuyuki <katsuyuki2388@gmail.com> writes:
> Sorry, I forgot to mention an exception in
> tab-line-switch-cycling docstring.
>
> The docstring modification patch is attached.
Thanks; applied (with minor modifications).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-09-13 13:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-09 6:48 tab-line-mode improvement Kiso Katsuyuki
2020-09-09 19:31 ` 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
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.