diff options
author | Juri Linkov <juri@linkov.net> | 2020-01-23 01:23:17 +0200 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2020-01-23 01:23:17 +0200 |
commit | 92f080dda8892861be7c175dc57f71dee0909d82 (patch) | |
tree | 75235966aeb408d18ef187a835b884d6086c3fcd /lisp/tab-bar.el | |
parent | 224e8d146485ce178086549d41fa8359dcc0e03e (diff) | |
download | emacs-92f080dda8892861be7c175dc57f71dee0909d82.tar.gz emacs-92f080dda8892861be7c175dc57f71dee0909d82.tar.bz2 emacs-92f080dda8892861be7c175dc57f71dee0909d82.zip |
Tab-bar related finishing touches.
* lisp/tab-bar.el (tab-bar-tab-name-ellipsis): Use shorter name
instead of tab-bar-tab-name-truncated-ellipsis.
(tab-bar-new-tab-to) <defcustom>: Add 'function' option.
(tab-bar-new-tab-to) <function>: Use it.
* lisp/tab-line.el (tab-line-close-tab): Add missing arg 'tab' to
tab-line-close-tab-function funcall.
Diffstat (limited to 'lisp/tab-bar.el')
-rw-r--r-- | lisp/tab-bar.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index f70fb6baeee..eccab268dc9 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -360,19 +360,19 @@ to `tab-bar-tab-name-truncated'." :group 'tab-bar :version "27.1") -(defvar tab-bar-tab-name-truncated-ellipsis +(defvar tab-bar-tab-name-ellipsis (if (char-displayable-p ?…) "…" "...")) (defun tab-bar-tab-name-truncated () "Generate tab name from the buffer of the selected window. Truncate it to the length specified by `tab-bar-tab-name-truncated-max'. -Append ellipsis `tab-bar-tab-name-truncated-ellipsis' in this case." +Append ellipsis `tab-bar-tab-name-ellipsis' in this case." (let ((tab-name (buffer-name (window-buffer (minibuffer-selected-window))))) (if (< (length tab-name) tab-bar-tab-name-truncated-max) tab-name (propertize (truncate-string-to-width tab-name tab-bar-tab-name-truncated-max nil nil - tab-bar-tab-name-truncated-ellipsis) + tab-bar-tab-name-ellipsis) 'help-echo tab-name)))) @@ -722,11 +722,14 @@ Interactively, ARG selects the ARGth different frame to move to." If `leftmost', create as the first tab. If `left', create to the left from the current tab. If `right', create to the right from the current tab. -If `rightmost', create as the last tab." +If `rightmost', create as the last tab. +If the value is a function, it should return a number as a position +on the tab bar specifying where to insert a new tab." :type '(choice (const :tag "First tab" leftmost) (const :tag "To the left" left) (const :tag "To the right" right) - (const :tag "Last tab" rightmost)) + (const :tag "Last tab" rightmost) + (function :tag "Function")) :group 'tab-bar :version "27.1") @@ -773,7 +776,9 @@ After the tab is created, the hooks in ('leftmost 0) ('rightmost (length tabs)) ('left (1- (or from-index 1))) - ('right (1+ (or from-index 0))))))) + ('right (1+ (or from-index 0))) + ((pred functionp) + (funcall tab-bar-new-tab-to)))))) (setq to-index (max 0 (min (or to-index 0) (length tabs)))) (cl-pushnew to-tab (nthcdr to-index tabs)) |