emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] feature/tabs a7289c0: * lisp/tab-bar.el (tab-bar-make-keym


From: Juri Linkov
Subject: [Emacs-diffs] feature/tabs a7289c0: * lisp/tab-bar.el (tab-bar-make-keymap-1): Don't use fixed "Current tab".
Date: Sat, 7 Sep 2019 16:42:12 -0400 (EDT)

branch: feature/tabs
commit a7289c0488fd55260d29685b6c1b79b8a3cd8f92
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * 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.
---
 lisp/tab-bar.el  | 18 +++++++++++++-----
 lisp/tab-line.el | 11 ++++++++---
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index f596bdb..de4faa2 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 92802b6..2122a14 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]