1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-01 08:17:38 +00:00

* lisp/tab-bar.el: 'C-x t RET' creates a new tab for non-existent tab name.

* lisp/tab-bar.el (tab-bar-switch-to-tab): Create a new tab and
rename it to NAME when can't find the tab with the given NAME (bug#51935).
This commit is contained in:
Juri Linkov 2021-11-22 20:15:28 +02:00
parent d096e12f44
commit eef6626b55
2 changed files with 13 additions and 2 deletions

View File

@ -181,6 +181,11 @@ For example, a 'display-buffer-alist' entry of
will make the body of the chosen window 40 columns wide. For the
height use 'window-height' in combination with 'body-lines'.
** Tab Bars and Tab Lines
---
*** 'C-x t RET' creates a new tab when the provided tab name doesn't exist.
** Better detection of text suspiciously reordered on display.
The function 'bidi-find-overridden-directionality' has been extended
to detect reordering effects produced by embeddings and isolates

View File

@ -1196,7 +1196,9 @@ Interactively, ARG is the prefix numeric argument and defaults to 1."
Default values are tab names sorted by recency, so you can use \
\\<minibuffer-local-map>\\[next-history-element]
to get the name of the most recently visited tab, the second
most recent, and so on."
most recent, and so on.
When the tab with that NAME doesn't exist, create a new tab
and rename it to NAME."
(interactive
(let* ((recent-tabs (mapcar (lambda (tab)
(alist-get 'name tab))
@ -1204,7 +1206,11 @@ most recent, and so on."
(list (completing-read (format-prompt "Switch to tab by name"
(car recent-tabs))
recent-tabs nil nil nil nil recent-tabs))))
(tab-bar-select-tab (1+ (or (tab-bar--tab-index-by-name name) 0))))
(let ((tab-index (tab-bar--tab-index-by-name name)))
(if tab-index
(tab-bar-select-tab (1+ tab-index))
(tab-bar-new-tab)
(tab-bar-rename-tab name))))
(defalias 'tab-bar-select-tab-by-name 'tab-bar-switch-to-tab)