From: Juri Linkov Date: Sat, 7 Sep 2019 20:04:24 +0000 (+0300) Subject: * lisp/tab-bar.el (tab-bar-make-keymap-1): Don't use fixed "Current tab". X-Git-Tag: emacs-27.0.90~1328^2~12 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a7289c0488fd55260d29685b6c1b79b8a3cd8f92;p=emacs.git * lisp/tab-bar.el (tab-bar-make-keymap-1): Don't use fixed "Current tab". * lisp/tab-bar.el (tab-bar-make-keymap-1): * lisp/tab-line.el (tab-line-tab-name-add): Add space after Unicode char to avoid char clobbering on terminals. --- diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index f596bdb0a4f..de4faa2a4d7 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -171,6 +171,16 @@ Return its existing value or a new value." (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)) @@ -181,7 +191,7 @@ Return its existing value or a new value." ((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 @@ -194,8 +204,7 @@ Return its existing value or a new value." :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)) @@ -206,8 +215,7 @@ Return its existing value or a new value." :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"))))) diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 92802b6d299..2122a14be67 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -113,9 +113,14 @@ "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]")) (defun tab-line-tab-name (buffer &optional buffers)