From 76b04b36c98d47dcebefbbae977c6744daa324c0 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 28 Mar 2003 12:02:48 +0000 Subject: [PATCH] Synch to Oort Gnus 200303280941. --- lisp/ChangeLog | 14 ++++++++++++++ lisp/gnus-registry.el | 33 +++++++++++++++++++++++++++++++-- lisp/gnus-start.el | 8 +++++++- lisp/gnus.el | 5 +++++ 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7cc5fb1..1fc305e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2003-03-28 Teodor Zlatanov + + * gnus-start.el (gnus-read-newsrc-el-hook): new hook called by gnus-read-newsrc-el-file + (gnus-read-newsrc-el-file): call the gnus-read-newsrc-el-hook + + * gnus-registry.el (gnus-registry-translate-to-alist) + (gnus-registry-translate-from-alist, alist-to-hashtable) + (hashtable-to-alist): new functions + (gnus-register-spool-action): add a spool item to the registry + + * gnus.el (gnus-variable-list): added gnus-registry-alist to the + list of saved variables + (gnus-registry-alist): new variable + 2003-03-27 Simon Josefsson * gnus-art.el (article-decode-group-name): Be correct instead of diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el index 6c11631..5bed64a 100644 --- a/lisp/gnus-registry.el +++ b/lisp/gnus-registry.el @@ -52,6 +52,31 @@ ;; alias puthash is missing from Emacs 20 cl-extra.el (defalias 'puthash 'cl-puthash))) +(defun gnus-registry-translate-to-alist + (setq gnus-registry-alist (hashtable-to-alist gnus-registry-hashtb))) + +(defun gnus-registry-translate-from-alist + (setq gnus-registry-hashtb (alist-to-hashtable gnus-registry-alist))) + +(defun alist-to-hashtable (alist) + "Build a hashtable from the values in ALIST." + (let ((ht (make-hash-table + :size 4096 + :test 'equal))) + (mapc + (lambda (kv-pair) + (puthash (car kv-pair) (cdr kv-pair) ht)) + alist) + ht)) + +(defun hashtable-to-alist (hash) + "Build an alist from the values in HASH." + (let ((list nil)) + (maphash + (lambda (key value) + (setq list (cons (cons key value) list))) + hash))) + (defun gnus-register-action (action data-header from &optional to method) (let* ((id (mail-header-id data-header)) (hash-entry (gethash id gnus-registry-hashtb))) @@ -71,15 +96,19 @@ (gnus-group-prefixed-name group gnus-internal-registry-spool-current-method - t))) + t)) + (puthash id (cons (list 'spool nil group nil) + (gethash id gnus-registry-hashtb)) gnus-registry-hashtb)) (add-hook 'gnus-summary-article-move-hook 'gnus-register-action) ; also does copy, respool, and crosspost (add-hook 'gnus-summary-article-delete-hook 'gnus-register-action) (add-hook 'gnus-summary-article-expire-hook 'gnus-register-action) (add-hook 'nnmail-spool-hook 'gnus-register-spool-action) +(add-hook 'gnus-save-newsrc-hook 'gnus-registry-translate-to-alist) +(add-hook 'gnus-read-newsrc-el-hook 'gnus-registry-translate-from-alist) + ;; TODO: a lot of things -;; TODO: we have to load and save the registry through gnus-save-newsrc-file (provide 'gnus-registry) diff --git a/lisp/gnus-start.el b/lisp/gnus-start.el index c1a5ec2..1fb8d25 100644 --- a/lisp/gnus-start.el +++ b/lisp/gnus-start.el @@ -412,6 +412,11 @@ This hook is called as the first thing when Gnus is started." :group 'gnus-group-new :type 'hook) +(defcustom gnus-read-newsrc-el-hook nil + "A hook called after reading the newsrc.eld? file." + :group 'gnus-newsrc + :type 'hook) + (defcustom gnus-save-newsrc-hook nil "A hook called before saving any of the newsrc files." :group 'gnus-newsrc @@ -2231,7 +2236,8 @@ If FORCE is non-nil, the .newsrc file is read." (let ((list gnus-product-variable-file-list)) (while list (apply 'gnus-product-read-variable-file-1 (car list)) - (setq list (cdr list)))))) + (setq list (cdr list))))) + (gnus-run-hooks 'gnus-read-newsrc-el-hook)) ;;(defun gnus-re-read-newsrc-el-file (file) ;; "Attempt to re-read .newsrc.eld file. Returns nil if successful. diff --git a/lisp/gnus.el b/lisp/gnus.el index fc93a9b..af67aca 100644 --- a/lisp/gnus.el +++ b/lisp/gnus.el @@ -2330,6 +2330,7 @@ This variable can be nil, gnus or gnus-ja." '(gnus-newsrc-options gnus-newsrc-options-n gnus-newsrc-last-checked-date gnus-newsrc-alist gnus-server-alist + gnus-registry-alist gnus-killed-list gnus-zombie-list gnus-topic-topology gnus-topic-alist gnus-agent-covered-methods) @@ -2373,6 +2374,10 @@ It has an effect on the values of `gnus-*-line-format-spec'." "Assoc list of read articles. gnus-newsrc-hashtb should be kept so that both hold the same information.") +(defvar gnus-registry-alist nil + "Assoc list of registry data. +gnus-registry.el will populate this if it's loaded.") + (defvar gnus-newsrc-hashtb nil "Hashtable of gnus-newsrc-alist.") -- 1.7.10.4