From: Juri Linkov Date: Wed, 29 Jan 2020 23:22:19 +0000 (+0200) Subject: Tab-bar related fixes. X-Git-Tag: emacs-27.0.90~86 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=de41161534;p=emacs.git Tab-bar related fixes. * lisp/cus-start.el (tab-bar-mode): Use dedicated group 'tab-bar'. * lisp/tab-bar.el (tab-bar-history-mode): Add :group 'tab-bar'. (tab-bar-get-buffer-tab): Add optional arg 'ignore-current-tab'. * lisp/desktop.el (desktop-buffers-not-to-save-function): Add docstring. --- diff --git a/lisp/cus-start.el b/lisp/cus-start.el index e3dc6f03c4b..dff4d9a6060 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -324,7 +324,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of ;; FIXME? ;; :initialize custom-initialize-default :set custom-set-minor-mode) - (tab-bar-mode (frames mouse) boolean nil + (tab-bar-mode tab-bar boolean nil ;; :initialize custom-initialize-default :set custom-set-minor-mode) (tool-bar-mode (frames mouse) boolean nil diff --git a/lisp/desktop.el b/lisp/desktop.el index bfab50da463..7745b50b64c 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -946,7 +946,12 @@ which means to truncate VAR's value to at most MAX-SIZE elements ")\n")))) ;; ---------------------------------------------------------------------------- -(defvar desktop-buffers-not-to-save-function nil) +(defvar desktop-buffers-not-to-save-function nil + "Function identifying buffers that are to be excluded from saving. +Like `desktop-buffers-not-to-save' it can be used to check whether +a given buffer should not be saved. It takes the same arguments as +`desktop-save-buffer-p' and should return nil if buffer should not +have its state saved in the desktop file.") (defun desktop-save-buffer-p (filename bufname mode &rest rest) "Return t if buffer should have its state saved in the desktop file. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index eccab268dc9..ebb0c566ad1 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1123,7 +1123,7 @@ function `tab-bar-tab-name-function'." (define-minor-mode tab-bar-history-mode "Toggle tab history mode for the tab bar." - :global t + :global t :group 'tab-bar (if tab-bar-history-mode (progn (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-back-button))) @@ -1400,7 +1400,7 @@ in the selected frame." ((framep all-frames) (list all-frames)) (t (list (selected-frame))))) -(defun tab-bar-get-buffer-tab (buffer-or-name &optional all-frames) +(defun tab-bar-get-buffer-tab (buffer-or-name &optional all-frames ignore-current-tab) "Return a tab owning a window whose buffer is BUFFER-OR-NAME. BUFFER-OR-NAME may be a buffer or a buffer name and defaults to the current buffer. @@ -1414,7 +1414,10 @@ The optional argument ALL-FRAMES specifies the frames to consider: - A frame means consider all tabs on that frame only. Any other value of ALL-FRAMES means consider all tabs on the -selected frame and no others." +selected frame and no others. + +When the optional argument IGNORE-CURRENT-TAB is non-nil, +don't take into account the buffers in the currently selected tab." (let ((buffer (if buffer-or-name (get-buffer buffer-or-name) (current-buffer)))) @@ -1424,7 +1427,8 @@ selected frame and no others." (seq-some (lambda (tab) (when (if (eq (car tab) 'current-tab) - (get-buffer-window buffer frame) + (unless ignore-current-tab + (get-buffer-window buffer frame)) (let* ((state (alist-get 'ws tab)) (buffers (when state (window-state-buffers state))))