[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0146591: Implement tab-close-other bound to C-x 6 1
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] master 0146591: Implement tab-close-other bound to C-x 6 1 by analogy with C-x 5 1. |
Date: |
Sun, 6 Oct 2019 17:53:43 -0400 (EDT) |
branch: master
commit 01465915c93d11fe26c189386d7103cf4904bf6a
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
Implement tab-close-other bound to C-x 6 1 by analogy with C-x 5 1.
* lisp/tab-bar.el (tab-close-other): New command bound to C-x 6 1.
* doc/emacs/frames.texi (Tab Bars): Document it.
---
doc/emacs/frames.texi | 5 +++++
lisp/tab-bar.el | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 869b77d..169eeba 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -1307,6 +1307,11 @@ Switch to another tab. If you repeat this command, it
cycles through
all the tabs on the selected frame. With a positive numeric argument
N, it switches to the next Nth tab; with a negative argument −N, it
switches back to the previous Nth tab.
+
+@item C-x 6 1
+@kindex C-x 6 1
+@findex tab-close-other
+Close all tabs on the selected frame, except the selected one.
@end table
@node Dialog Boxes
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 27ae274..1c1acaa 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -560,6 +560,17 @@ TO-INDEX counts from 1."
(tab-bar-tabs)))))
(tab-bar-close-tab (1+ (tab-bar--tab-index-by-name name))))
+(defun tab-close-other ()
+ "Close all tabs on the selected frame, except the selected one."
+ (interactive)
+ (let* ((tabs (tab-bar-tabs))
+ (current-index (tab-bar--current-tab-index tabs)))
+ (when current-index
+ (set-frame-parameter nil 'tabs (list (nth current-index tabs)))
+ (if tab-bar-mode
+ (force-mode-line-update)
+ (message "Deleted all other tabs")))))
+
;;; Short aliases
@@ -819,6 +830,7 @@ Like \\[find-file-other-frame] (which see), but creates a
new tab."
(switch-to-buffer-other-tab value))))
(define-key ctl-x-6-map "2" 'tab-new)
+(define-key ctl-x-6-map "1" 'tab-close-other)
(define-key ctl-x-6-map "0" 'tab-close)
(define-key ctl-x-6-map "o" 'tab-next)
(define-key ctl-x-6-map "b" 'switch-to-buffer-other-tab)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 0146591: Implement tab-close-other bound to C-x 6 1 by analogy with C-x 5 1.,
Juri Linkov <=