aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2019-10-27 00:57:04 +0300
committerJuri Linkov2019-10-27 00:57:04 +0300
commit802dc5d4dcf899371cd1bacd06eeef8c15129fd4 (patch)
tree753129385082000e236e1c157d967b4a3781afcb
parent6d2ea60ca874f04c37527b21355f81a2b140d405 (diff)
downloademacs-802dc5d4dcf899371cd1bacd06eeef8c15129fd4.tar.gz
emacs-802dc5d4dcf899371cd1bacd06eeef8c15129fd4.zip
* lisp/tab-bar.el (tab-bar-move-tab-to): Add force-mode-line-update.
(tab-bar-close-last-tab-choice, tab-bar-close-tab): Adjust option names.
-rw-r--r--lisp/tab-bar.el38
1 files changed, 20 insertions, 18 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index d664774b6c0..f7b0f261139 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -536,7 +536,8 @@ FROM-INDEX and TO-INDEX count from 1."
536 (to-index (max 0 (min (1- to-index) (1- (length tabs)))))) 536 (to-index (max 0 (min (1- to-index) (1- (length tabs))))))
537 (setq tabs (delq from-tab tabs)) 537 (setq tabs (delq from-tab tabs))
538 (cl-pushnew from-tab (nthcdr to-index tabs)) 538 (cl-pushnew from-tab (nthcdr to-index tabs))
539 (set-frame-parameter nil 'tabs tabs))) 539 (set-frame-parameter nil 'tabs tabs)
540 (force-mode-line-update)))
540 541
541(defun tab-bar-move-tab (&optional arg) 542(defun tab-bar-move-tab (&optional arg)
542 "Move the current tab ARG positions to the right. 543 "Move the current tab ARG positions to the right.
@@ -637,12 +638,12 @@ If `right', select the adjacent right tab."
637(defcustom tab-bar-close-last-tab-choice nil 638(defcustom tab-bar-close-last-tab-choice nil
638 "Defines what to do when the last tab is closed. 639 "Defines what to do when the last tab is closed.
639If nil, do nothing and show a message, like closing the last window or frame. 640If nil, do nothing and show a message, like closing the last window or frame.
640If `close-frame', delete the containing frame, as a web browser would do. 641If `delete-frame', delete the containing frame, as a web browser would do.
641If `disable-tab-bar', disable tab-bar-mode so that tabs no longer show in the frame. 642If `tab-bar-mode-disable', disable tab-bar-mode so that tabs no longer show in the frame.
642If the value is a function, call that function with the tab to be closed as an argument." 643If the value is a function, call that function with the tab to be closed as an argument."
643 :type '(choice (const :tag "Do nothing and show message" nil) 644 :type '(choice (const :tag "Do nothing and show message" nil)
644 (const :tag "Delete the containing frame" close-frame) 645 (const :tag "Close the containing frame" delete-frame)
645 (const :tag "Disable tab-bar-mode" disable-tab-bar) 646 (const :tag "Disable tab-bar-mode" tab-bar-mode-disable)
646 (function :tag "Function")) 647 (function :tag "Function"))
647 :group 'tab-bar 648 :group 'tab-bar
648 :version "27.1") 649 :version "27.1")
@@ -661,20 +662,21 @@ TO-INDEX counts from 1."
661 (current-index (tab-bar--current-tab-index tabs)) 662 (current-index (tab-bar--current-tab-index tabs))
662 (close-index (if (integerp arg) (1- arg) current-index))) 663 (close-index (if (integerp arg) (1- arg) current-index)))
663 (if (= 1 (length tabs)) 664 (if (= 1 (length tabs))
664 (pcase tab-bar-close-last-tab-choice 665 (pcase tab-bar-close-last-tab-choice
665 ('nil 666 ('nil
666 (signal 'user-error '("Attempt to delete the sole tab in a frame"))) 667 (signal 'user-error '("Attempt to delete the sole tab in a frame")))
667 ('close-frame 668 ('delete-frame
668 (delete-frame)) 669 (delete-frame))
669 ('disable-tab-bar 670 ('tab-bar-mode-disable
670 (tab-bar-mode -1)) 671 (tab-bar-mode -1))
671 ((pred functionp) 672 ((pred functionp)
672 ;; Give the handler function the full extent of the tab's 673 ;; Give the handler function the full extent of the tab's
673 ;; data, not just it's name and explicit-name flag. 674 ;; data, not just it's name and explicit-name flag.
674 (funcall tab-bar-close-last-tab-choice (tab-bar--tab)))) 675 (funcall tab-bar-close-last-tab-choice (tab-bar--tab))))
675 676
676 ;;; More than one tab still open 677 ;; More than one tab still open
677 (when (eq current-index close-index) 678 (when (eq current-index close-index)
679 ;; Select another tab before deleting the current tab
678 (let ((to-index (or (if to-index (1- to-index)) 680 (let ((to-index (or (if to-index (1- to-index))
679 (pcase tab-bar-close-tab-select 681 (pcase tab-bar-close-tab-select
680 ('left (1- current-index)) 682 ('left (1- current-index))