* lisp/tab-bar.el (tab-prefix-map): Bind "n" to 'tab-duplicate'.

(tab-bar-separator): New function.
(tab-bar-make-keymap-1): Use it.
This commit is contained in:
Juri Linkov 2021-02-23 20:57:31 +02:00
parent a1333fe6cf
commit 0b9fda1fd9
2 changed files with 10 additions and 6 deletions

View file

@ -483,13 +483,13 @@ value of 'tab-bar-show'.
It can be used to enable/disable the tab bar individually on each frame
independently from the value of 'tab-bar-mode' and 'tab-bar-show'.
---
*** New command 'tab-duplicate'.
---
*** 'Mod-9' bound to 'tab-last' now switches to the last tab.
It also supports a negative argument.
---
*** New command 'tab-duplicate' bound to 'C-x t n'.
---
*** 'C-x t N' creates a new tab at the specified absolute position.
It also supports a negative argument.

View file

@ -379,6 +379,9 @@ and `tab-bar-select-tab-modifiers'."
(defvar tab-bar-separator nil
"String that delimits tabs.")
(defun tab-bar-separator ()
(or tab-bar-separator (if window-system " " "|")))
(defcustom tab-bar-tab-name-function #'tab-bar-tab-name-current
"Function to get a tab name.
@ -502,9 +505,9 @@ the formatted tab name to display in the tab bar."
(defun tab-bar-make-keymap-1 ()
"Generate an actual keymap from `tab-bar-map', without caching."
(let* ((separator (or tab-bar-separator (if window-system " " "|")))
(i 0)
(tabs (funcall tab-bar-tabs-function)))
(let ((separator (tab-bar-separator))
(tabs (funcall tab-bar-tabs-function))
(i 0))
(append
'(keymap (mouse-1 . tab-bar-handle-mouse))
(when (and tab-bar-history-mode tab-bar-history-buttons-show)
@ -1699,6 +1702,7 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
nil "[other-tab]")
(message "Display next command buffer in a new tab..."))
(define-key tab-prefix-map "n" 'tab-duplicate)
(define-key tab-prefix-map "N" 'tab-new-to)
(define-key tab-prefix-map "2" 'tab-new)
(define-key tab-prefix-map "1" 'tab-close-other)