From 0b9fda1fd92e92b65836cbb2f3dd0761ab837d55 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 23 Feb 2021 20:57:31 +0200 Subject: [PATCH] * 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 236c8a9730a..122ac508c85 100644 --- 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. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 41844e6f5c8..0893a98e606 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) -- 2.39.2