emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master a81223a: Only use Gnus registry for formatting when


From: Eric Abrahamsen
Subject: [Emacs-diffs] master a81223a: Only use Gnus registry for formatting when registry is loaded
Date: Thu, 19 Sep 2019 13:38:55 -0400 (EDT)

branch: master
commit a81223aeaa0d89954a10d9b5912665aedb0b9c74
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Only use Gnus registry for formatting when registry is loaded
    
    See bug #36903
    
    * lisp/gnus/gnus-registry.el (gnus-registry-article-marks-to-chars):
      (gnus-registry-article-marks-to-names): In some circumstances it's
      possible for the user's summary line format spec to include
      registry-specific code, while the registry itself isn't actually
      loaded. Make sure the database is actually a hashtable before
      accessing it.
---
 lisp/gnus/gnus-registry.el | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index e949179..ff0d4ba 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -1007,23 +1007,27 @@ Uses `gnus-registry-marks' to find what shortcuts to 
install."
 ;; (defalias 'gnus-user-format-function-M 
'gnus-registry-article-marks-to-chars)
 (defun gnus-registry-article-marks-to-chars (headers)
   "Show the marks for an article by the :char property."
-  (let* ((id (mail-header-message-id headers))
-         (marks (when id (gnus-registry-get-id-key id 'mark))))
-    (concat (delq nil
-                 (mapcar
-                  (lambda (m)
-                    (plist-get
-                     (cdr-safe (assoc m gnus-registry-marks))
-                     :char))
-                  marks)))))
+  (if (hash-table-p gnus-registry-db)
+      (let* ((id (mail-header-message-id headers))
+             (marks (when id (gnus-registry-get-id-key id 'mark))))
+       (concat (delq nil
+                     (mapcar
+                      (lambda (m)
+                        (plist-get
+                         (cdr-safe (assoc m gnus-registry-marks))
+                         :char))
+                      marks))))
+    ""))
 
 ;; use like this:
 ;; (defalias 'gnus-user-format-function-M 
'gnus-registry-article-marks-to-names)
 (defun gnus-registry-article-marks-to-names (headers)
   "Show the marks for an article by name."
-  (let* ((id (mail-header-message-id headers))
-         (marks (when id (gnus-registry-get-id-key id 'mark))))
-    (mapconcat (lambda (mark) (symbol-name mark)) marks ",")))
+  (if (hash-table-p gnus-registry-db)
+      (let* ((id (mail-header-message-id headers))
+             (marks (when id (gnus-registry-get-id-key id 'mark))))
+       (mapconcat (lambda (mark) (symbol-name mark)) marks ","))
+    ""))
 
 (defun gnus-registry-read-mark ()
   "Read a mark name from the user with completion."



reply via email to

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