aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2020-03-13 02:10:55 +0200
committerJuri Linkov2020-03-13 02:10:55 +0200
commitecfe633993a12cc1475bb9282178e238e8025a13 (patch)
tree3167eadf098713497fb802da23211556a6232af3
parentc1ce9fa7f2b1d88637e8d8f03f08d8ddd2ff9e4a (diff)
downloademacs-ecfe633993a12cc1475bb9282178e238e8025a13.tar.gz
emacs-ecfe633993a12cc1475bb9282178e238e8025a13.zip
* lisp/tab-bar.el: Last-minute changes.
* lisp/tab-bar.el (tab-bar-mode): Check for non-nil tab-bar-new-button and tab-bar-close-button. (tab-bar-new-button-show): New defcustom. (tab-bar-make-keymap-1): Check for tab-bar-new-button-show. (tab-bar-separator): Add docstring.
-rw-r--r--lisp/tab-bar.el25
1 files changed, 19 insertions, 6 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index fac27f41ba9..e2ea11d2af9 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -123,7 +123,8 @@ Possible modifiers are `control', `meta', `shift', `hyper', `super' and
123 (assq-delete-all 'tab-bar-lines 123 (assq-delete-all 'tab-bar-lines
124 default-frame-alist))))) 124 default-frame-alist)))))
125 125
126 (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-new-button))) 126 (when (and tab-bar-mode tab-bar-new-button
127 (not (get-text-property 0 'display tab-bar-new-button)))
127 ;; This file is pre-loaded so only here we can use the right data-directory: 128 ;; This file is pre-loaded so only here we can use the right data-directory:
128 (add-text-properties 0 (length tab-bar-new-button) 129 (add-text-properties 0 (length tab-bar-new-button)
129 `(display (image :type xpm 130 `(display (image :type xpm
@@ -132,7 +133,8 @@ Possible modifiers are `control', `meta', `shift', `hyper', `super' and
132 :ascent center)) 133 :ascent center))
133 tab-bar-new-button)) 134 tab-bar-new-button))
134 135
135 (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-close-button))) 136 (when (and tab-bar-mode tab-bar-close-button
137 (not (get-text-property 0 'display tab-bar-close-button)))
136 ;; This file is pre-loaded so only here we can use the right data-directory: 138 ;; This file is pre-loaded so only here we can use the right data-directory:
137 (add-text-properties 0 (length tab-bar-close-button) 139 (add-text-properties 0 (length tab-bar-close-button)
138 `(display (image :type xpm 140 `(display (image :type xpm
@@ -263,6 +265,16 @@ before calling the command that adds a new tab."
263 :group 'tab-bar 265 :group 'tab-bar
264 :version "27.1") 266 :version "27.1")
265 267
268(defcustom tab-bar-new-button-show t
269 "Defines whether to show the new tab button."
270 :type 'boolean
271 :initialize 'custom-initialize-default
272 :set (lambda (sym val)
273 (set-default sym val)
274 (force-mode-line-update))
275 :group 'tab-bar
276 :version "27.1")
277
266(defvar tab-bar-new-button " + " 278(defvar tab-bar-new-button " + "
267 "Button for creating a new tab.") 279 "Button for creating a new tab.")
268 280
@@ -306,7 +318,8 @@ This helps to select the tab by its number using `tab-bar-select-tab'."
306 :group 'tab-bar 318 :group 'tab-bar
307 :version "27.1") 319 :version "27.1")
308 320
309(defvar tab-bar-separator nil) 321(defvar tab-bar-separator nil
322 "String that delimits tabs.")
310 323
311 324
312(defcustom tab-bar-tab-name-function #'tab-bar-tab-name-current 325(defcustom tab-bar-tab-name-function #'tab-bar-tab-name-current
@@ -464,9 +477,9 @@ Return its existing value or a new value."
464 (interactive) 477 (interactive)
465 (tab-bar-close-tab ,i))))))) 478 (tab-bar-close-tab ,i)))))))
466 tabs) 479 tabs)
467 (when tab-bar-new-button 480 `((sep-add-tab menu-item ,separator ignore))
468 `((sep-add-tab menu-item ,separator ignore) 481 (when (and tab-bar-new-button-show tab-bar-new-button)
469 (add-tab menu-item ,tab-bar-new-button tab-bar-new-tab 482 `((add-tab menu-item ,tab-bar-new-button tab-bar-new-tab
470 :help "New tab")))))) 483 :help "New tab"))))))
471 484
472 485