diff options
| author | Teodor Zlatanov | 2011-04-06 12:55:49 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2011-04-06 12:55:49 +0000 |
| commit | 42b237655fd30f72a0784c2e0c3b86d28277e893 (patch) | |
| tree | 9ed9d438669e943e37239eb61ed57b30bdc604df | |
| parent | 3338398778900f0b66a2f20b947e31861384fe04 (diff) | |
| download | emacs-42b237655fd30f72a0784c2e0c3b86d28277e893.tar.gz emacs-42b237655fd30f72a0784c2e0c3b86d28277e893.zip | |
gnus-registry.el: Don't use ERT if it's not available.
(gnus-registry-delete-entries): New convenience function.
(gnus-registry-import-eld): Import from old .eld registry.
registry.el: Don't use ERT if it's not available.
proto-stream.el (gnutls-negotiate): Revert inadvertent commit of the version from the Claudio Bley GnuTLS patch (extra optional parametersnand host name).
| -rw-r--r-- | lisp/gnus/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/gnus/gnus-registry.el | 53 | ||||
| -rw-r--r-- | lisp/gnus/registry.el | 5 |
3 files changed, 68 insertions, 2 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 8115d5ca2b8..b79a5de55e1 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2011-04-06 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * gnus-registry.el: Don't use ERT if it's not available. | ||
| 4 | (gnus-registry-delete-entries): New convenience function. | ||
| 5 | (gnus-registry-import-eld): Import from old .eld registry. | ||
| 6 | |||
| 7 | * registry.el: Don't use ERT if it's not available. | ||
| 8 | |||
| 9 | * proto-stream.el (gnutls-negotiate): Revert inadvertent commit of the | ||
| 10 | version from the Claudio Bley GnuTLS patch (extra optional parameters | ||
| 11 | and host name). | ||
| 12 | |||
| 1 | 2011-04-05 Teodor Zlatanov <tzz@lifelogs.com> | 13 | 2011-04-05 Teodor Zlatanov <tzz@lifelogs.com> |
| 2 | 14 | ||
| 3 | * gnus-registry.el (gnus-registry-fixup-registry): New function to | 15 | * gnus-registry.el (gnus-registry-fixup-registry): New function to |
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 3ab8400a500..511012df577 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el | |||
| @@ -57,7 +57,10 @@ | |||
| 57 | 57 | ||
| 58 | (eval-when-compile (require 'cl)) | 58 | (eval-when-compile (require 'cl)) |
| 59 | 59 | ||
| 60 | (require 'ert) | 60 | (eval-when-compile |
| 61 | (when (null (require 'ert nil t)) | ||
| 62 | (defmacro* ert-deftest (name () &body docstring-keys-and-body)))) | ||
| 63 | |||
| 61 | (require 'gnus) | 64 | (require 'gnus) |
| 62 | (require 'gnus-int) | 65 | (require 'gnus-int) |
| 63 | (require 'gnus-sum) | 66 | (require 'gnus-sum) |
| @@ -807,6 +810,9 @@ only the last one's marks are returned." | |||
| 807 | 810 | ||
| 808 | (nth 1 (assoc id entries)))) | 811 | (nth 1 (assoc id entries)))) |
| 809 | 812 | ||
| 813 | (defun gnus-registry-delete-entries (idlist) | ||
| 814 | (registry-delete gnus-registry-db idlist nil)) | ||
| 815 | |||
| 810 | (defun gnus-registry-get-id-key (id key) | 816 | (defun gnus-registry-get-id-key (id key) |
| 811 | (cdr-safe (assq key (gnus-registry-get-or-make-entry id)))) | 817 | (cdr-safe (assq key (gnus-registry-get-or-make-entry id)))) |
| 812 | 818 | ||
| @@ -818,6 +824,51 @@ only the last one's marks are returned." | |||
| 818 | (registry-insert db id entry) | 824 | (registry-insert db id entry) |
| 819 | entry)) | 825 | entry)) |
| 820 | 826 | ||
| 827 | (defun gnus-registry-import-eld (file) | ||
| 828 | (interactive "fOld registry file to import? ") | ||
| 829 | ;; example content: | ||
| 830 | ;; (setq gnus-registry-alist '( | ||
| 831 | ;; ("<messageID>" ((marks nil) | ||
| 832 | ;; (mtime 19365 1776 440496) | ||
| 833 | ;; (sender . "root (Cron Daemon)") | ||
| 834 | ;; (subject . "Cron")) | ||
| 835 | ;; "cron" "nnml+private:cron") | ||
| 836 | (load file t) | ||
| 837 | (when (boundp 'gnus-registry-alist) | ||
| 838 | (let* ((old (symbol-value 'gnus-registry-alist)) | ||
| 839 | (count 0) | ||
| 840 | (expected (length old)) | ||
| 841 | entry) | ||
| 842 | (while (car-safe old) | ||
| 843 | (incf count) | ||
| 844 | ;; don't use progress reporters for backwards compatibility | ||
| 845 | (when (and (< 0 expected) | ||
| 846 | (= 0 (mod count 100))) | ||
| 847 | (message "importing: %d of %d (%.2f%%)" | ||
| 848 | count expected (/ (* 100 count) expected))) | ||
| 849 | (setq entry (car-safe old) | ||
| 850 | old (cdr-safe old)) | ||
| 851 | (let* ((id (car-safe entry)) | ||
| 852 | (new-entry (gnus-registry-get-or-make-entry id)) | ||
| 853 | (rest (cdr-safe entry)) | ||
| 854 | (groups (loop for p in rest | ||
| 855 | when (stringp p) | ||
| 856 | collect p)) | ||
| 857 | extra-cell key val) | ||
| 858 | ;; remove all the strings from the entry | ||
| 859 | (delete* nil rest :test (lambda (a b) (stringp b))) | ||
| 860 | (gnus-registry-set-id-key id 'group groups) | ||
| 861 | ;; just use the first extra element | ||
| 862 | (setq rest (car-safe rest)) | ||
| 863 | (while (car-safe rest) | ||
| 864 | (setq extra-cell (car-safe rest) | ||
| 865 | key (car-safe extra-cell) | ||
| 866 | val (cdr-safe extra-cell) | ||
| 867 | rest (cdr-safe rest)) | ||
| 868 | (when (and val (atom val)) | ||
| 869 | (setq val (list val))) | ||
| 870 | (gnus-registry-set-id-key id key val)))) | ||
| 871 | (message "Import done, collected %d entries" count)))) | ||
| 821 | 872 | ||
| 822 | (ert-deftest gnus-registry-usage-test () | 873 | (ert-deftest gnus-registry-usage-test () |
| 823 | (let* ((n 100) | 874 | (let* ((n 100) |
diff --git a/lisp/gnus/registry.el b/lisp/gnus/registry.el index 319da8ffab7..cc03b20662d 100644 --- a/lisp/gnus/registry.el +++ b/lisp/gnus/registry.el | |||
| @@ -77,7 +77,10 @@ | |||
| 77 | 77 | ||
| 78 | ;;; Code: | 78 | ;;; Code: |
| 79 | 79 | ||
| 80 | (eval-when-compile (require 'ert)) | 80 | (eval-when-compile |
| 81 | (when (null (require 'ert nil t)) | ||
| 82 | (defmacro* ert-deftest (name () &body docstring-keys-and-body)))) | ||
| 83 | |||
| 81 | (eval-when-compile (require 'cl)) | 84 | (eval-when-compile (require 'cl)) |
| 82 | (eval-and-compile | 85 | (eval-and-compile |
| 83 | (or (ignore-errors (progn | 86 | (or (ignore-errors (progn |