]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify gnus-mode-line-buffer-identification
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 8 Dec 2020 13:17:36 +0000 (14:17 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 8 Dec 2020 13:17:36 +0000 (14:17 +0100)
* lisp/gnus/gnus.el (gnus-mode-line-image-cache): Remove.
(gnus-mode-line-buffer-identification): Use the find-image cache.

lisp/gnus/gnus.el

index 2edda5f1fef2aadf3f004f0c1917b066f07620e4..abe7b1ae76a2af9bccd5edbe5637330345c89078 100644 (file)
@@ -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.