From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com>
To: emacs-devel@gnu.org
Subject: Re: Some ideas to improve Tab Bar
Date: Thu, 26 Nov 2020 20:08:48 -0300 [thread overview]
Message-ID: <CH2PR01MB587976B74D69E140AFB024378BF90@CH2PR01MB5879.prod.exchangelabs.com> (raw)
In-Reply-To: <CH2PR01MB5879C29C3B023B1DA0DE97AD8BFA0@CH2PR01MB5879.prod.exchangelabs.com> (Gabriel do Nascimento Ribeiro's message of "Wed, 25 Nov 2020 00:35:59 +0000")
[-- Attachment #1: Type: text/plain, Size: 494 bytes --]
Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com> writes:
> Some little ideas on how Tab Bar can be further improved:
>
> 1. Options to disable `tab-bar-back-button' and `tab-bar-forward-button' when `tab-bar-history-mode' is on. This will be similar to what option `tab-bar-close-button-show' is to `tab-bar-close-button'.
The idea of this patch is to add a new option called
`tab-bar-history-buttons-show' to control the visibility of
`tab-bar-history-mode' back and forward buttons.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to add option to control visibility of tab-bar-history buttons --]
[-- Type: text/x-diff, Size: 1142 bytes --]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 2604955224..05611b48bb 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -296,6 +296,16 @@ tab-bar-back-button
(defvar tab-bar-forward-button " > "
"Button for going forward in tab history.")
+(defcustom tab-bar-history-buttons-show t
+ "Show back and forward buttons when `tab-bar-history-mode' is enabled."
+ :type 'boolean
+ :initialize 'custom-initialize-default
+ :set (lambda (sym val)
+ (set-default sym val)
+ (force-mode-line-update))
+ :group 'tab-bar
+ :version "28.1")
+
(defcustom tab-bar-tab-hints nil
"Show absolute numbers on tabs in the tab bar before the tab name.
This helps to select the tab by its number using `tab-bar-select-tab'
@@ -415,7 +425,7 @@ tab-bar-make-keymap-1
(tabs (funcall tab-bar-tabs-function)))
(append
'(keymap (mouse-1 . tab-bar-handle-mouse))
- (when tab-bar-history-mode
+ (when (and tab-bar-history-mode tab-bar-history-buttons-show)
`((sep-history-back menu-item ,separator ignore)
(history-back
menu-item ,tab-bar-back-button tab-bar-history-back
[-- Attachment #3: Type: text/plain, Size: 448 bytes --]
> 2. Trim spaces of tab bar name. The tab bar name can have additional spaces on the right:
> 2.1. When tab bar name name is set explicitly with `tab-bar-rename-tab';
> 2.2. When `tab-bar-tab-hints' is true and `tab-bar-tab-name-function' returns an empty string;
>
The idea of this patch is to add a new option called
`tab-bar-tab-name-format-function' where a custom function can be
specified to format the string value of `tab-name'.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: Patch to add option to specify custom function to format tab name --]
[-- Type: text/x-diff, Size: 2247 bytes --]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 2604955224..82f3ca2385 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -334,6 +334,18 @@ tab-bar-tab-name-function
:group 'tab-bar
:version "27.1")
+(defcustom tab-bar-tab-name-format-function nil
+ "Function to format a tab name.
+Function get one argument, the tab name, and should return
+the formatted tab name."
+ :type 'function
+ :initialize 'custom-initialize-default
+ :set (lambda (sym val)
+ (set-default sym val)
+ (force-mode-line-update))
+ :group 'tab-bar
+ :version "28.1")
+
(defun tab-bar-tab-name-current ()
"Generate tab name from the buffer of the selected window."
(buffer-name (window-buffer (minibuffer-selected-window))))
@@ -433,8 +445,9 @@ tab-bar-make-keymap-1
((eq (car tab) 'current-tab)
`((current-tab
menu-item
- ,(propertize (concat (if tab-bar-tab-hints (format "%d " i) "")
- (alist-get 'name tab)
+ ,(propertize (concat (funcall (or tab-bar-tab-name-format-function 'identity)
+ (concat (if tab-bar-tab-hints (format "%d " i) "")
+ (alist-get 'name tab)))
(or (and tab-bar-close-button-show
(not (eq tab-bar-close-button-show
'non-selected))
@@ -445,8 +458,9 @@ tab-bar-make-keymap-1
(t
`((,(intern (format "tab-%i" i))
menu-item
- ,(propertize (concat (if tab-bar-tab-hints (format "%d " i) "")
- (alist-get 'name tab)
+ ,(propertize (concat (funcall (or tab-bar-tab-name-format-function 'identity)
+ (concat (if tab-bar-tab-hints (format "%d " i) "")
+ (alist-get 'name tab)))
(or (and tab-bar-close-button-show
(not (eq tab-bar-close-button-show
'selected))
[-- Attachment #5: Type: text/plain, Size: 18 bytes --]
Regards,
Gabriel
next prev parent reply other threads:[~2020-11-26 23:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 0:35 Some ideas to improve Tab Bar Gabriel do Nascimento Ribeiro
2020-11-25 7:47 ` Juri Linkov
2020-11-25 17:19 ` Gabriel do Nascimento Ribeiro
2020-11-25 19:22 ` Juri Linkov
2021-02-27 20:12 ` Juri Linkov
2021-03-01 23:15 ` Gabriel do Nascimento Ribeiro
2021-03-02 19:46 ` Juri Linkov
2020-11-26 23:08 ` Gabriel do Nascimento Ribeiro [this message]
2020-11-27 8:22 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CH2PR01MB587976B74D69E140AFB024378BF90@CH2PR01MB5879.prod.exchangelabs.com \
--to=gabriel376@hotmail.com \
--cc=emacs-devel@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).