diff options
| author | Juri Linkov <juri@linkov.net> | 2019-10-07 00:53:34 +0300 | 
|---|---|---|
| committer | Juri Linkov <juri@linkov.net> | 2019-10-07 00:53:34 +0300 | 
| commit | 01465915c93d11fe26c189386d7103cf4904bf6a (patch) | |
| tree | 97cff9145b5062d6bdd6d2f86d5f27edd4175320 /lisp | |
| parent | d24a19779028f1fe940b43eb72e6c68d2d835bd7 (diff) | |
| download | emacs-01465915c93d11fe26c189386d7103cf4904bf6a.tar.gz | |
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/tab-bar.el | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 27ae274eaa4..1c1acaafa47 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) | 
