aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Abrahamsen2019-09-19 10:36:42 -0700
committerEric Abrahamsen2019-09-19 10:36:42 -0700
commita81223aeaa0d89954a10d9b5912665aedb0b9c74 (patch)
tree4f55d78274b5cbe5c203cdb41f24d3d5c3dadfb6
parent2b80340bf3585f976d88da94ee9d40eb03230c6b (diff)
downloademacs-a81223aeaa0d89954a10d9b5912665aedb0b9c74.tar.gz
emacs-a81223aeaa0d89954a10d9b5912665aedb0b9c74.zip
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.
-rw-r--r--lisp/gnus/gnus-registry.el28
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index e949179b3cc..ff0d4bad715 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."
1007;; (defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-chars) 1007;; (defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-chars)
1008(defun gnus-registry-article-marks-to-chars (headers) 1008(defun gnus-registry-article-marks-to-chars (headers)
1009 "Show the marks for an article by the :char property." 1009 "Show the marks for an article by the :char property."
1010 (let* ((id (mail-header-message-id headers)) 1010 (if (hash-table-p gnus-registry-db)
1011 (marks (when id (gnus-registry-get-id-key id 'mark)))) 1011 (let* ((id (mail-header-message-id headers))
1012 (concat (delq nil 1012 (marks (when id (gnus-registry-get-id-key id 'mark))))
1013 (mapcar 1013 (concat (delq nil
1014 (lambda (m) 1014 (mapcar
1015 (plist-get 1015 (lambda (m)
1016 (cdr-safe (assoc m gnus-registry-marks)) 1016 (plist-get
1017 :char)) 1017 (cdr-safe (assoc m gnus-registry-marks))
1018 marks))))) 1018 :char))
1019 marks))))
1020 ""))
1019 1021
1020;; use like this: 1022;; use like this:
1021;; (defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-names) 1023;; (defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-names)
1022(defun gnus-registry-article-marks-to-names (headers) 1024(defun gnus-registry-article-marks-to-names (headers)
1023 "Show the marks for an article by name." 1025 "Show the marks for an article by name."
1024 (let* ((id (mail-header-message-id headers)) 1026 (if (hash-table-p gnus-registry-db)
1025 (marks (when id (gnus-registry-get-id-key id 'mark)))) 1027 (let* ((id (mail-header-message-id headers))
1026 (mapconcat (lambda (mark) (symbol-name mark)) marks ","))) 1028 (marks (when id (gnus-registry-get-id-key id 'mark))))
1029 (mapconcat (lambda (mark) (symbol-name mark)) marks ","))
1030 ""))
1027 1031
1028(defun gnus-registry-read-mark () 1032(defun gnus-registry-read-mark ()
1029 "Read a mark name from the user with completion." 1033 "Read a mark name from the user with completion."