summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2020-03-13 02:10:55 +0200
committerJuri Linkov <juri@linkov.net>2020-03-13 02:10:55 +0200
commitecfe633993a12cc1475bb9282178e238e8025a13 (patch)
tree3167eadf098713497fb802da23211556a6232af3
parentc1ce9fa7f2b1d88637e8d8f03f08d8ddd2ff9e4a (diff)
downloademacs-ecfe633993a12cc1475bb9282178e238e8025a13.tar.gz
* 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
(assq-delete-all 'tab-bar-lines
default-frame-alist)))))
- (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-new-button)))
+ (when (and tab-bar-mode tab-bar-new-button
+ (not (get-text-property 0 'display tab-bar-new-button)))
;; This file is pre-loaded so only here we can use the right data-directory:
(add-text-properties 0 (length tab-bar-new-button)
`(display (image :type xpm
@@ -132,7 +133,8 @@ Possible modifiers are `control', `meta', `shift', `hyper', `super' and
:ascent center))
tab-bar-new-button))
- (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-close-button)))
+ (when (and tab-bar-mode tab-bar-close-button
+ (not (get-text-property 0 'display tab-bar-close-button)))
;; This file is pre-loaded so only here we can use the right data-directory:
(add-text-properties 0 (length tab-bar-close-button)
`(display (image :type xpm
@@ -263,6 +265,16 @@ before calling the command that adds a new tab."
:group 'tab-bar
:version "27.1")
+(defcustom tab-bar-new-button-show t
+ "Defines whether to show the new tab button."
+ :type 'boolean
+ :initialize 'custom-initialize-default
+ :set (lambda (sym val)
+ (set-default sym val)
+ (force-mode-line-update))
+ :group 'tab-bar
+ :version "27.1")
+
(defvar tab-bar-new-button " + "
"Button for creating a new tab.")
@@ -306,7 +318,8 @@ This helps to select the tab by its number using `tab-bar-select-tab'."
:group 'tab-bar
:version "27.1")
-(defvar tab-bar-separator nil)
+(defvar tab-bar-separator nil
+ "String that delimits tabs.")
(defcustom tab-bar-tab-name-function #'tab-bar-tab-name-current
@@ -464,9 +477,9 @@ Return its existing value or a new value."
(interactive)
(tab-bar-close-tab ,i)))))))
tabs)
- (when tab-bar-new-button
- `((sep-add-tab menu-item ,separator ignore)
- (add-tab menu-item ,tab-bar-new-button tab-bar-new-tab
+ `((sep-add-tab menu-item ,separator ignore))
+ (when (and tab-bar-new-button-show tab-bar-new-button)
+ `((add-tab menu-item ,tab-bar-new-button tab-bar-new-tab
:help "New tab"))))))