]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/tab-bar.el (tab-prefix-map): Bind "n" to 'tab-duplicate'.
authorJuri Linkov <juri@linkov.net>
Tue, 23 Feb 2021 18:57:31 +0000 (20:57 +0200)
committerJuri Linkov <juri@linkov.net>
Tue, 23 Feb 2021 18:57:31 +0000 (20:57 +0200)
(tab-bar-separator): New function.
(tab-bar-make-keymap-1): Use it.

etc/NEWS
lisp/tab-bar.el

index 236c8a9730a3ba4593358c31818403a17f91d032..122ac508c85c0ab20615913dcd1b13aa7d17034d 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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.
index 41844e6f5c8ff9247fafe128d9fbf4d722af440c..0893a98e606181e492dcac9a768edb1f566b82a3 100644 (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 " " "|")))
+
 \f
 (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)