summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-02-17 19:56:45 +0200
committerJuri Linkov <juri@linkov.net>2021-02-17 19:56:45 +0200
commit734396aa04cd57173f1a604397244ed84f3f56a8 (patch)
tree39ae3567525caba9ff594cc397687dd6ad8fd07c
parente5f50f32f76bab2607d77f0dc51cf81ec0c1e232 (diff)
downloademacs-734396aa04cd57173f1a604397244ed84f3f56a8.tar.gz
emacs-734396aa04cd57173f1a604397244ed84f3f56a8.tar.bz2
emacs-734396aa04cd57173f1a604397244ed84f3f56a8.zip
New command 'tab-duplicate' like in web browsers
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/tab-bar.el9
2 files changed, 12 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 3bef7399fa8..5c7acfdefaa 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -472,6 +472,9 @@ 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'.
+
+---
*** New user option 'tab-bar-tab-name-format-function'.
---
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index f0210e1a42b..dba79fbd81c 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -897,6 +897,14 @@ If ARG is zero, create a new tab in place of the current tab."
(tab-bar-new-tab-to (1+ to-index)))
(tab-bar-new-tab-to)))
+(defun tab-bar-duplicate-tab (&optional arg)
+ "Duplicate the current tab to ARG positions to the right.
+If a negative ARG, duplicate the tab to ARG positions to the left.
+If ARG is zero, duplicate the tab in place of the current tab."
+ (interactive "P")
+ (let ((tab-bar-new-tab-choice nil))
+ (tab-bar-new-tab arg)))
+
(defvar tab-bar-closed-tabs nil
"A list of closed tabs to be able to undo their closing.")
@@ -1243,6 +1251,7 @@ and can restore them."
(defalias 'tab-new 'tab-bar-new-tab)
(defalias 'tab-new-to 'tab-bar-new-tab-to)
+(defalias 'tab-duplicate 'tab-bar-duplicate-tab)
(defalias 'tab-close 'tab-bar-close-tab)
(defalias 'tab-close-other 'tab-bar-close-other-tabs)
(defalias 'tab-undo 'tab-bar-undo-close-tab)