[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 0b9fda1 1/2: * lisp/tab-bar.el (tab-prefix-map): Bind "n" to 'tab
From: |
Juri Linkov |
Subject: |
master 0b9fda1 1/2: * lisp/tab-bar.el (tab-prefix-map): Bind "n" to 'tab-duplicate'. |
Date: |
Tue, 23 Feb 2021 14:01:58 -0500 (EST) |
branch: master
commit 0b9fda1fd92e92b65836cbb2f3dd0761ab837d55
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/tab-bar.el (tab-prefix-map): Bind "n" to 'tab-duplicate'.
(tab-bar-separator): New function.
(tab-bar-make-keymap-1): Use it.
---
etc/NEWS | 6 +++---
lisp/tab-bar.el | 10 +++++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 236c8a9..122ac50 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -484,13 +484,13 @@ 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.
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 41844e6..0893a98 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -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)