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
(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")))))
+
\f
;;; Short aliases
(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)