emacs-diffs
[Top][All Lists]
Advanced

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

master fbb9dd3 1/2: Simplify gnus-mode-line-buffer-identification


From: Lars Ingebrigtsen
Subject: master fbb9dd3 1/2: Simplify gnus-mode-line-buffer-identification
Date: Tue, 8 Dec 2020 08:20:20 -0500 (EST)

branch: master
commit fbb9dd3e82163c24c0660322ca914612462e0050
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Simplify gnus-mode-line-buffer-identification
    
    * lisp/gnus/gnus.el (gnus-mode-line-image-cache): Remove.
    (gnus-mode-line-buffer-identification): Use the find-image cache.
---
 lisp/gnus/gnus.el | 51 +++++++++++++++++++++++----------------------------
 1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 2edda5f..abe7b1a 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -309,34 +309,29 @@ be set in `.emacs' instead."
   :group 'gnus-start
   :type 'boolean)
 
-(defvar gnus-mode-line-image-cache t)
-
-(eval-and-compile
-  (if (fboundp 'find-image)
-      (defun gnus-mode-line-buffer-identification (line)
-       (let ((str (car-safe line))
-             (load-path (append (mm-image-load-path) load-path)))
-         (if (and (display-graphic-p)
-                  (stringp str)
-                  (string-match "^Gnus:" str))
-             (progn (add-text-properties
-                     0 5
-                     (list 'display
-                           (if (eq t gnus-mode-line-image-cache)
-                               (setq gnus-mode-line-image-cache
-                                     (find-image
-                                      '((:type xpm :file "gnus-pointer.xpm"
-                                               :ascent center)
-                                        (:type xbm :file "gnus-pointer.xbm"
-                                               :ascent center))))
-                             gnus-mode-line-image-cache)
-                           'help-echo (format
-                                       "This is %s, %s."
-                                       gnus-version (gnus-emacs-version)))
-                     str)
-                    (list str))
-           line)))
-    (defalias 'gnus-mode-line-buffer-identification 'identity)))
+(defun gnus-mode-line-buffer-identification (line)
+  (let ((str (car-safe line)))
+    (if (or (not (fboundp 'find-image))
+           (not (display-graphic-p))
+           (not (stringp str))
+           (not (string-match "^Gnus:" str)))
+       line
+      (let ((load-path (append (mm-image-load-path) load-path)))
+       ;; Add the Gnus logo.
+       (add-text-properties
+        0 5
+        (list 'display
+              (find-image
+               '((:type xpm :file "gnus-pointer.xpm"
+                        :ascent center)
+                 (:type xbm :file "gnus-pointer.xbm"
+                        :ascent center))
+               t)
+              'help-echo (format
+                          "This is %s, %s."
+                          gnus-version (gnus-emacs-version)))
+        str)
+       (list str)))))
 
 ;; We define these group faces here to avoid the display
 ;; update forced when creating new faces.



reply via email to

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