aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2019-09-07 23:04:24 +0300
committerJuri Linkov2019-09-07 23:04:24 +0300
commita7289c0488fd55260d29685b6c1b79b8a3cd8f92 (patch)
treeac5ff95af1a8c8d7ebcbc50b163cc01966a22719
parent2a0164753456d0f788aa026bdd903ac76519d6ab (diff)
downloademacs-a7289c0488fd55260d29685b6c1b79b8a3cd8f92.tar.gz
emacs-a7289c0488fd55260d29685b6c1b79b8a3cd8f92.zip
* 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.
-rw-r--r--lisp/tab-bar.el18
-rw-r--r--lisp/tab-line.el11
2 files changed, 21 insertions, 8 deletions
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."
171 171
172(defun tab-bar-make-keymap-1 () 172(defun tab-bar-make-keymap-1 ()
173 "Generate an actual keymap from `tab-bar-map', without caching." 173 "Generate an actual keymap from `tab-bar-map', without caching."
174 ;; Can't check for char-displayable-p in defvar
175 ;; because this file is preloaded.
176 (unless tab-bar-tab-name-add
177 (setq tab-bar-tab-name-add
178 (if (char-displayable-p ?➕) "➕" "[+]")))
179 (unless tab-bar-tab-name-close
180 (setq tab-bar-tab-name-close
181 ;; Need to add space after Unicode char on terminals
182 ;; to avoid clobbering next char by wide Unicode char.
183 (if (char-displayable-p ?⮿) (if window-system "⮿" "⮿ ") "[x]")))
174 (let ((i 0)) 184 (let ((i 0))
175 (append 185 (append
176 '(keymap (mouse-1 . tab-bar-mouse)) 186 '(keymap (mouse-1 . tab-bar-mouse))
@@ -181,7 +191,7 @@ Return its existing value or a new value."
181 ((eq (car tab) 'current-tab) 191 ((eq (car tab) 'current-tab)
182 `(current-tab 192 `(current-tab
183 menu-item 193 menu-item
184 ,(propertize "Current tab" 'face 'tab-bar-tab) 194 ,(propertize (cdr (assq 'name tab)) 'face 'tab-bar-tab)
185 ignore 195 ignore
186 :help "Current tab")) 196 :help "Current tab"))
187 (t 197 (t
@@ -194,8 +204,7 @@ Return its existing value or a new value."
194 :help "Click to visit tab"))) 204 :help "Click to visit tab")))
195 `(,(intern (format "close-tab-%i" i)) 205 `(,(intern (format "close-tab-%i" i))
196 menu-item 206 menu-item
197 ,(concat (propertize (or tab-bar-tab-name-close 207 ,(concat (propertize tab-bar-tab-name-close
198 (if (char-displayable-p ?⮿) "⮿" "[x]"))
199 'face (if (eq (car tab) 'current-tab) 208 'face (if (eq (car tab) 'current-tab)
200 'tab-bar-tab 209 'tab-bar-tab
201 'tab-bar-tab-inactive)) 210 'tab-bar-tab-inactive))
@@ -206,8 +215,7 @@ Return its existing value or a new value."
206 :help "Click to close tab"))) 215 :help "Click to close tab")))
207 (tab-bar-tabs)) 216 (tab-bar-tabs))
208 `((add-tab menu-item 217 `((add-tab menu-item
209 ,(propertize (or tab-bar-tab-name-add 218 ,(propertize tab-bar-tab-name-add
210 (if (char-displayable-p ?➕) "➕" "[+]"))
211 'face 'tab-bar-tab-inactive) 219 'face 'tab-bar-tab-inactive)
212 tab-bar-add-tab 220 tab-bar-add-tab
213 :help "Click to add tab"))))) 221 :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 @@
113 "Local keymap to close `tab-line-mode' window tabs.") 113 "Local keymap to close `tab-line-mode' window tabs.")
114 114
115(defvar tab-line-separator " ") 115(defvar tab-line-separator " ")
116(defvar tab-line-tab-name-ellipsis (if (char-displayable-p ?…) "…" "...")) 116(defvar tab-line-tab-name-ellipsis
117(defvar tab-line-tab-name-add (if (char-displayable-p ?➕) "➕" "[+]")) 117 (if (char-displayable-p ?…) "…" "..."))
118(defvar tab-line-tab-name-close (if (char-displayable-p ?⮿) "⮿" "[x]")) 118(defvar tab-line-tab-name-add
119 (if (char-displayable-p ?➕) "➕" "[+]"))
120(defvar tab-line-tab-name-close
121 ;; Need to add space after Unicode char on terminals
122 ;; to avoid clobbering next char by wide Unicode char.
123 (if (char-displayable-p ?⮿) (if window-system "⮿" "⮿ ") "[x]"))
119 124
120 125
121(defun tab-line-tab-name (buffer &optional buffers) 126(defun tab-line-tab-name (buffer &optional buffers)