Add new variable tab-bar-format-tab-help-text-function
* lisp/tab-bar.el (tab-bar--format-tab): Add new variable 'tab-bar-format-tab-help-text-function' and a default function 'tab-bar-format-tab-help-text-default'. 'tab-bar--format-tab' respects this new variable when producing a tab's help text, normally shown in the echo area or via tooltips (bug#75950).
This commit is contained in:
parent
3479d42406
commit
f45a776fe3
2 changed files with 20 additions and 2 deletions
7
etc/NEWS
7
etc/NEWS
|
@ -256,6 +256,13 @@ This is useful to avoid key binding conflicts, such as when folding in
|
|||
outline mode using TAB keys, or when a user wants to define her own
|
||||
tab-bar keys without first having to remove the defaults.
|
||||
|
||||
---
|
||||
*** New variable 'tab-bar-format-tab-help-text-function'.
|
||||
This variable may be overridden with a user-provided function to
|
||||
customize help text for tabs displayed on the tab-bar. Help text is
|
||||
normally shown in the echo area or via tooltips. See the variable's
|
||||
docstring for arguments passed to a help-text function.
|
||||
|
||||
** Project
|
||||
|
||||
---
|
||||
|
|
|
@ -992,6 +992,17 @@ You can hide these buttons by customizing `tab-bar-format' and removing
|
|||
menu-item ,tab-bar-forward-button tab-bar-history-forward
|
||||
:help "Click to go forward in tab history"))))
|
||||
|
||||
(defun tab-bar-format-tab-help-text-default (tab _i)
|
||||
(alist-get 'name tab))
|
||||
|
||||
(defvar tab-bar-format-tab-help-text-function #'tab-bar-format-tab-help-text-default
|
||||
"Function to produce help text for tabs displayed in the tab bar.
|
||||
This function should accept two arguments: the tab, and the one-based
|
||||
tab's number.
|
||||
|
||||
The function should produce a string, which may be propertized. By
|
||||
default, use function `tab-bar-format-tab-help-text-default.")
|
||||
|
||||
(defun tab-bar--format-tab (tab i)
|
||||
"Format TAB using its index I and return the result as a keymap."
|
||||
(append
|
||||
|
@ -1002,13 +1013,13 @@ You can hide these buttons by customizing `tab-bar-format' and removing
|
|||
menu-item
|
||||
,(funcall tab-bar-tab-name-format-function tab i)
|
||||
ignore
|
||||
:help ,(alist-get 'name tab))))
|
||||
:help ,(funcall tab-bar-format-tab-help-text-function tab i))))
|
||||
(t
|
||||
`((,(intern (format "tab-%i" i))
|
||||
menu-item
|
||||
,(funcall tab-bar-tab-name-format-function tab i)
|
||||
,(alist-get 'binding tab)
|
||||
:help ,(alist-get 'name tab)))))
|
||||
:help ,(funcall tab-bar-format-tab-help-text-function tab i)))))
|
||||
(when (alist-get 'close-binding tab)
|
||||
`((,(if (eq (car tab) 'current-tab) 'C-current-tab
|
||||
(intern (format "C-tab-%i" i)))
|
||||
|
|
Loading…
Add table
Reference in a new issue