aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2019-10-10 01:42:56 +0300
committerJuri Linkov2019-10-10 01:42:56 +0300
commit235b8b3a6d0b9ece617ab6408e72f1cf69bb919a (patch)
tree7307f840c49a1d7971b58caa86c852aca0fe92c2
parent4d6c1260eaef47e2da3f9842d035cdad2a967601 (diff)
downloademacs-235b8b3a6d0b9ece617ab6408e72f1cf69bb919a.tar.gz
emacs-235b8b3a6d0b9ece617ab6408e72f1cf69bb919a.zip
* lisp/tab-bar.el: Don't show window count for one window.
* lisp/tab-bar.el (tab-bar-tab-name-selected-window): Don't show the number of windows when there is only one window in the window configuration. (tab-bar-close-other-tabs): Rename from tab-close-other. Take into account tab-bar-show to turn off when needed. (tab-close-other): Alias to tab-bar-close-other-tabs.
-rw-r--r--lisp/tab-bar.el24
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 91bc589ae29..c4eba8600ac 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -268,7 +268,10 @@ from all windows in the window configuration."
268(defun tab-bar-tab-name-selected-window () 268(defun tab-bar-tab-name-selected-window ()
269 "Generate tab name from the buffer of the selected window. 269 "Generate tab name from the buffer of the selected window.
270Also add the number of windows in the window configuration." 270Also add the number of windows in the window configuration."
271 (format "%s (%d)" (buffer-name) (length (window-list-1 nil 'nomini)))) 271 (let ((count (length (window-list-1 nil 'nomini))))
272 (if (> count 1)
273 (format "%s (%d)" (buffer-name) count)
274 (format "%s" (buffer-name)))))
272 275
273(defun tab-bar-tab-name-all-windows () 276(defun tab-bar-tab-name-all-windows ()
274 "Generate tab name from buffers of all windows." 277 "Generate tab name from buffers of all windows."
@@ -576,13 +579,17 @@ TO-INDEX counts from 1."
576 (tab-bar-tabs))))) 579 (tab-bar-tabs)))))
577 (tab-bar-close-tab (1+ (tab-bar--tab-index-by-name name)))) 580 (tab-bar-close-tab (1+ (tab-bar--tab-index-by-name name))))
578 581
579(defun tab-close-other () 582(defun tab-bar-close-other-tabs ()
580 "Close all tabs on the selected frame, except the selected one." 583 "Close all tabs on the selected frame, except the selected one."
581 (interactive) 584 (interactive)
582 (let* ((tabs (tab-bar-tabs)) 585 (let* ((tabs (tab-bar-tabs))
583 (current-index (tab-bar--current-tab-index tabs))) 586 (current-index (tab-bar--current-tab-index tabs)))
584 (when current-index 587 (when current-index
585 (set-frame-parameter nil 'tabs (list (nth current-index tabs))) 588 (set-frame-parameter nil 'tabs (list (nth current-index tabs)))
589 (when (and tab-bar-mode
590 (and (natnump tab-bar-show)
591 (<= 1 tab-bar-show)))
592 (tab-bar-mode -1))
586 (if tab-bar-mode 593 (if tab-bar-mode
587 (force-mode-line-update) 594 (force-mode-line-update)
588 (message "Deleted all other tabs"))))) 595 (message "Deleted all other tabs")))))
@@ -590,12 +597,13 @@ TO-INDEX counts from 1."
590 597
591;;; Short aliases 598;;; Short aliases
592 599
593(defalias 'tab-new 'tab-bar-new-tab) 600(defalias 'tab-new 'tab-bar-new-tab)
594(defalias 'tab-close 'tab-bar-close-tab) 601(defalias 'tab-close 'tab-bar-close-tab)
595(defalias 'tab-select 'tab-bar-select-tab) 602(defalias 'tab-close-other 'tab-bar-close-other-tabs)
596(defalias 'tab-next 'tab-bar-switch-to-next-tab) 603(defalias 'tab-select 'tab-bar-select-tab)
597(defalias 'tab-previous 'tab-bar-switch-to-prev-tab) 604(defalias 'tab-next 'tab-bar-switch-to-next-tab)
598(defalias 'tab-list 'tab-bar-list) 605(defalias 'tab-previous 'tab-bar-switch-to-prev-tab)
606(defalias 'tab-list 'tab-bar-list)
599 607
600 608
601;;; Non-graphical access to frame-local tabs (named window configurations) 609;;; Non-graphical access to frame-local tabs (named window configurations)