(defun tab-bar-make-keymap-1 ()
"Generate an actual keymap from `tab-bar-map', without caching."
+ ;; Can't check for char-displayable-p in defvar
+ ;; because this file is preloaded.
+ (unless tab-bar-tab-name-add
+ (setq tab-bar-tab-name-add
+ (if (char-displayable-p ?➕) "➕" "[+]")))
+ (unless tab-bar-tab-name-close
+ (setq tab-bar-tab-name-close
+ ;; Need to add space after Unicode char on terminals
+ ;; to avoid clobbering next char by wide Unicode char.
+ (if (char-displayable-p ?⮿) (if window-system "⮿" "⮿ ") "[x]")))
(let ((i 0))
(append
'(keymap (mouse-1 . tab-bar-mouse))
((eq (car tab) 'current-tab)
`(current-tab
menu-item
- ,(propertize "Current tab" 'face 'tab-bar-tab)
+ ,(propertize (cdr (assq 'name tab)) 'face 'tab-bar-tab)
ignore
:help "Current tab"))
(t
:help "Click to visit tab")))
`(,(intern (format "close-tab-%i" i))
menu-item
- ,(concat (propertize (or tab-bar-tab-name-close
- (if (char-displayable-p ?⮿) "⮿" "[x]"))
+ ,(concat (propertize tab-bar-tab-name-close
'face (if (eq (car tab) 'current-tab)
'tab-bar-tab
'tab-bar-tab-inactive))
:help "Click to close tab")))
(tab-bar-tabs))
`((add-tab menu-item
- ,(propertize (or tab-bar-tab-name-add
- (if (char-displayable-p ?➕) "➕" "[+]"))
+ ,(propertize tab-bar-tab-name-add
'face 'tab-bar-tab-inactive)
tab-bar-add-tab
:help "Click to add tab")))))
"Local keymap to close `tab-line-mode' window tabs.")
(defvar tab-line-separator " ")
-(defvar tab-line-tab-name-ellipsis (if (char-displayable-p ?…) "…" "..."))
-(defvar tab-line-tab-name-add (if (char-displayable-p ?➕) "➕" "[+]"))
-(defvar tab-line-tab-name-close (if (char-displayable-p ?⮿) "⮿" "[x]"))
+(defvar tab-line-tab-name-ellipsis
+ (if (char-displayable-p ?…) "…" "..."))
+(defvar tab-line-tab-name-add
+ (if (char-displayable-p ?➕) "➕" "[+]"))
+(defvar tab-line-tab-name-close
+ ;; Need to add space after Unicode char on terminals
+ ;; to avoid clobbering next char by wide Unicode char.
+ (if (char-displayable-p ?⮿) (if window-system "⮿" "⮿ ") "[x]"))
\f
(defun tab-line-tab-name (buffer &optional buffers)