branch: elpa/eat
commit c8d54d649872bfe7b2b9f49ae5c2addbf12d3b99
Author: Akib Azmain Turja <a...@disroot.org>
Commit: Akib Azmain Turja <a...@disroot.org>

    Allow hiding terminal title from mode line
    
    * eat.el (eat-show-title-on-mode-line): New user option.
    * eat.el (eat-mode): Don't set mode-line-buffer-identification
    if eat-show-title-on-mode-line is nil.
---
 eat.el | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/eat.el b/eat.el
index 3ffbedab39..d4469cd17a 100644
--- a/eat.el
+++ b/eat.el
@@ -151,6 +151,11 @@ This is the default name used when running Eat."
   :type 'boolean
   :group 'eat-ui)
 
+(defcustom eat-show-title-on-mode-line t
+  "Non-nil means show terminal title on mode line."
+  :type 'boolean
+  :group 'eat-ui)
+
 (defcustom eat-term-scrollback-size 131072 ; 128 K
   "Size of scrollback area in characters.  nil means unlimited."
   :type '(choice natnum (const nil))
@@ -6703,19 +6708,21 @@ mouse-3: Switch to char mode"
                        (down-mouse-3 . eat-char-mode)))))
                  "]")))))
           ":%s"))
-  (setq mode-line-buffer-identification
-        `(12 (""
-              ,(nconc
-                (propertized-buffer-identification "%b")
-                '(" "
-                  (:propertize
-                   (:eval
-                    (when-let* ((eat-terminal)
-                                (title (eat-term-title eat-terminal))
-                                ((not (string-empty-p title))))
-                      (format "(%s)" (string-replace "%" "%%"
-                                                     title))))
-                   help-echo "Title"))))))
+  (when eat-show-title-on-mode-line
+    (setq mode-line-buffer-identification
+          `(12 (""
+                ,(nconc
+                  (propertized-buffer-identification "%b")
+                  '(" "
+                    (:propertize
+                     (:eval
+                      (when-let*
+                          ((eat-terminal)
+                           (title (eat-term-title eat-terminal))
+                           ((not (string-empty-p title))))
+                        (format "(%s)" (string-replace "%" "%%"
+                                                       title))))
+                     help-echo "Title")))))))
   (eat-emacs-mode)
   ;; Make sure glyphless character don't display a huge box glyph,
   ;; that would break the display.

Reply via email to