Merge from mainline.
[bpt/emacs.git] / lisp / gnus / gnus-registry.el
CommitLineData
23f87bed 1;;; gnus-registry.el --- article registry for Gnus
e84b4b86 2
73b0cd50 3;; Copyright (C) 2002-2011 Free Software Foundation, Inc.
23f87bed
MB
4
5;; Author: Ted Zlatanov <tzz@lifelogs.com>
0ab5c2be 6;; Keywords: news registry
23f87bed
MB
7
8;; This file is part of GNU Emacs.
9
5e809f55 10;; GNU Emacs is free software: you can redistribute it and/or modify
23f87bed 11;; it under the terms of the GNU General Public License as published by
5e809f55
GM
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
23f87bed
MB
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5e809f55 17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23f87bed
MB
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
5e809f55 21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23f87bed
MB
22
23;;; Commentary:
24
01c52d31 25;; This is the gnus-registry.el package, which works with all
11a3174d 26;; Gnus backends, not just nnmail. The major issue is that it
01c52d31
MB
27;; doesn't go across backends, so for instance if an article is in
28;; nnml:sys and you see a reference to it in nnimap splitting, the
29;; article will end up in nnimap:sys
23f87bed
MB
30
31;; gnus-registry.el intercepts article respooling, moving, deleting,
32;; and copying for all backends. If it doesn't work correctly for
33;; you, submit a bug report and I'll be glad to fix it. It needs
34;; documentation in the manual (also on my to-do list).
35
c3c65d73 36;; Put this in your startup file (~/.gnus.el for instance) or use Customize:
23f87bed 37
c3c65d73 38;; (setq gnus-registry-max-entries 2500
cf8b0c27 39;; gnus-registry-track-extra '(sender subject recipient))
23f87bed
MB
40
41;; (gnus-registry-initialize)
42
43;; Then use this in your fancy-split:
44
45;; (: gnus-registry-split-fancy-with-parent)
46
36d3245f
G
47;; You should also consider using the nnregistry backend to look up
48;; articles. See the Gnus manual for more information.
49
23f87bed
MB
50;; TODO:
51
52;; - get the correct group on spool actions
53
11a3174d
TZ
54;; - articles that are spooled to a different backend should be moved
55;; after splitting
23f87bed
MB
56
57;;; Code:
58
59(eval-when-compile (require 'cl))
60
42b23765 61(eval-when-compile
2237da9c 62 (when (null (ignore-errors (require 'ert)))
42b23765
TZ
63 (defmacro* ert-deftest (name () &body docstring-keys-and-body))))
64
2237da9c
G
65(ignore-errors
66 (require 'ert))
23f87bed
MB
67(require 'gnus)
68(require 'gnus-int)
69(require 'gnus-sum)
11a3174d 70(require 'gnus-art)
996aa8c1 71(require 'gnus-util)
23f87bed 72(require 'nnmail)
ec7995fa 73(require 'easymenu)
11a3174d 74(require 'registry)
23f87bed 75
9efa445f
DN
76(defvar gnus-adaptive-word-syntax-table)
77
23f87bed
MB
78(defvar gnus-registry-dirty t
79 "Boolean set to t when the registry is modified")
80
81(defgroup gnus-registry nil
82 "The Gnus registry."
bf247b6e 83 :version "22.1"
23f87bed
MB
84 :group 'gnus)
85
11a3174d 86(defvar gnus-registry-marks
14e8de0c 87 '((Important
8f7abae3
MB
88 :char ?i
89 :image "summary_important")
14e8de0c 90 (Work
8f7abae3
MB
91 :char ?w
92 :image "summary_work")
14e8de0c 93 (Personal
8f7abae3
MB
94 :char ?p
95 :image "summary_personal")
14e8de0c 96 (To-Do
8f7abae3
MB
97 :char ?t
98 :image "summary_todo")
14e8de0c 99 (Later
8f7abae3
MB
100 :char ?l
101 :image "summary_later"))
14e8de0c
MB
102
103 "List of registry marks and their options.
104
105`gnus-registry-mark-article' will offer symbols from this list
c9fc72fa 106for completion.
14e8de0c
MB
107
108Each entry must have a character to be useful for summary mode
109line display and for keyboard shortcuts.
110
111Each entry must have an image string to be useful for visual
11a3174d 112display.")
0b6799c3
MB
113
114(defcustom gnus-registry-default-mark 'To-Do
14e8de0c 115 "The default mark. Should be a valid key for `gnus-registry-marks'."
0b6799c3
MB
116 :group 'gnus-registry
117 :type 'symbol)
118
11a3174d
TZ
119(defcustom gnus-registry-unfollowed-addresses
120 (list (regexp-quote user-mail-address))
121 "List of addresses that gnus-registry-split-fancy-with-parent won't trace.
cf8b0c27
TZ
122The addresses are matched, they don't have to be fully qualified.
123In the messages, these addresses can be the sender or the
124recipients."
11a3174d
TZ
125 :group 'gnus-registry
126 :type '(repeat regexp))
127
c9fc72fa 128(defcustom gnus-registry-unfollowed-groups
a5954fa5 129 '("delayed$" "drafts$" "queue$" "INBOX$" "^nnmairix:" "archive")
01c52d31
MB
130 "List of groups that gnus-registry-split-fancy-with-parent won't return.
131The group names are matched, they don't have to be fully
11a3174d 132qualified. This parameter tells the Gnus registry 'never split a
01c52d31 133message into a group that matches one of these, regardless of
6b958814
G
134references.'
135
136nnmairix groups are specifically excluded because they are ephemeral."
23f87bed 137 :group 'gnus-registry
01c52d31 138 :type '(repeat regexp))
23f87bed 139
8f7abae3 140(defcustom gnus-registry-install 'ask
23f87bed
MB
141 "Whether the registry should be installed."
142 :group 'gnus-registry
8f7abae3 143 :type '(choice (const :tag "Never Install" nil)
11a3174d
TZ
144 (const :tag "Always Install" t)
145 (const :tag "Ask Me" ask)))
23f87bed 146
ec7995fa
KY
147(defvar gnus-summary-misc-menu) ;; Avoid byte compiler warning.
148
11a3174d 149(defvar gnus-registry-misc-menus nil) ; ugly way to keep the menus
23f87bed 150
11a3174d
TZ
151(make-obsolete-variable 'gnus-registry-clean-empty nil "23.4")
152(make-obsolete-variable 'gnus-registry-use-long-group-names nil "23.4")
153(make-obsolete-variable 'gnus-registry-max-track-groups nil "23.4")
154(make-obsolete-variable 'gnus-registry-entry-caching nil "23.4")
155(make-obsolete-variable 'gnus-registry-trim-articles-without-groups nil "23.4")
b86402ab 156
cf8b0c27 157(defcustom gnus-registry-track-extra '(subject sender recipient)
23f87bed 158 "Whether the registry should track extra data about a message.
cf8b0c27
TZ
159The subject, recipients (To: and Cc:), and Sender (From:) headers
160are tracked this way by default."
23f87bed 161 :group 'gnus-registry
bf247b6e 162 :type
23f87bed
MB
163 '(set :tag "Tracking choices"
164 (const :tag "Track by subject (Subject: header)" subject)
cf8b0c27 165 (const :tag "Track by recipient (To: and Cc: headers)" recipient)
23f87bed
MB
166 (const :tag "Track by sender (From: header)" sender)))
167
58a67d68 168(defcustom gnus-registry-split-strategy nil
11a3174d 169 "The splitting strategy applied to the keys in `gnus-registry-track-extra'.
58a67d68 170
11a3174d
TZ
171Given a set of unique found groups G and counts for each element
172of G, and a key K (typically 'sender or 'subject):
173
174When nil, if G has only one element, use it. Otherwise give up.
175This is the fastest but also least useful strategy.
176
177When 'majority, use the majority by count. So if there is a
178group with the most articles counted by K, use that. Ties are
179resolved in no particular order, simply the first one found wins.
180This is the slowest strategy but also the most accurate one.
181
182When 'first, the first element of G wins. This is fast and
183should be OK if your senders and subjects don't \"bleed\" across
184groups."
23f87bed 185 :group 'gnus-registry
11a3174d
TZ
186 :type
187 '(choice :tag "Splitting strategy"
188 (const :tag "Only use single choices, discard multiple matches" nil)
189 (const :tag "Majority of matches wins" majority)
190 (const :tag "First found wins" first)))
23f87bed
MB
191
192(defcustom gnus-registry-minimum-subject-length 5
193 "The minimum length of a subject before it's considered trackable."
194 :group 'gnus-registry
195 :type 'integer)
196
11a3174d
TZ
197(defcustom gnus-registry-extra-entries-precious '(mark)
198 "What extra keys are precious, meaning entries with them won't get pruned.
199By default, 'mark is included, so articles with marks are
200considered precious.
201
202Before you save the Gnus registry, it's pruned. Any entries with
203keys in this list will not be pruned. All other entries go to
204the Bit Bucket."
0b6799c3
MB
205 :group 'gnus-registry
206 :type '(repeat symbol))
207
c9fc72fa
LMI
208(defcustom gnus-registry-cache-file
209 (nnheader-concat
210 (or gnus-dribble-directory gnus-home-directory "~/")
11a3174d 211 ".gnus.registry.eioio")
23f87bed
MB
212 "File where the Gnus registry will be stored."
213 :group 'gnus-registry
214 :type 'file)
215
216(defcustom gnus-registry-max-entries nil
217 "Maximum number of entries in the registry, nil for unlimited."
218 :group 'gnus-registry
219 :type '(radio (const :format "Unlimited " nil)
11a3174d 220 (integer :format "Maximum number: %v")))
23f87bed 221
11a3174d
TZ
222(defcustom gnus-registry-max-pruned-entries nil
223 "Maximum number of pruned entries in the registry, nil for unlimited."
224 :group 'gnus-registry
225 :type '(radio (const :format "Unlimited " nil)
226 (integer :format "Maximum number: %v")))
227
228(defun gnus-registry-fixup-registry (db)
229 (when db
cf8b0c27
TZ
230 (let ((old (oref db :tracked)))
231 (oset db :precious
232 (append gnus-registry-extra-entries-precious
233 '()))
234 (oset db :max-hard
235 (or gnus-registry-max-entries
236 most-positive-fixnum))
237 (oset db :max-soft
238 (or gnus-registry-max-pruned-entries
239 most-positive-fixnum))
240 (oset db :tracked
241 (append gnus-registry-track-extra
242 '(mark group keyword)))
243 (when (not (equal old (oref db :tracked)))
244 (gnus-message 4 "Reindexing the Gnus registry (tracked change)")
245 (registry-reindex db))))
11a3174d
TZ
246 db)
247
248(defun gnus-registry-make-db (&optional file)
249 (interactive "fGnus registry persistence file: \n")
250 (gnus-registry-fixup-registry
251 (registry-db
252 "Gnus Registry"
253 :file (or file gnus-registry-cache-file)
254 ;; these parameters are set in `gnus-registry-fixup-registry'
255 :max-hard most-positive-fixnum
256 :max-soft most-positive-fixnum
257 :precious nil
258 :tracked nil)))
259
260(defvar gnus-registry-db (gnus-registry-make-db)
261 "*The article registry by Message ID. See `registry-db'")
262
263;; top-level registry data management
264(defun gnus-registry-remake-db (&optional forsure)
265 "Remake the registry database after customization.
266This is not required after changing `gnus-registry-cache-file'."
267 (interactive (list (y-or-n-p "Remake and CLEAR the Gnus registry? ")))
268 (when forsure
1e3b6001 269 (gnus-message 4 "Remaking the Gnus registry")
11a3174d 270 (setq gnus-registry-db (gnus-registry-make-db))))
23f87bed 271
11a3174d 272(defun gnus-registry-read ()
23f87bed
MB
273 "Read the registry cache file."
274 (interactive)
275 (let ((file gnus-registry-cache-file))
11a3174d
TZ
276 (condition-case nil
277 (progn
278 (gnus-message 5 "Reading Gnus registry from %s..." file)
279 (setq gnus-registry-db (gnus-registry-fixup-registry
280 (eieio-persistent-read file)))
281 (gnus-message 5 "Reading Gnus registry from %s...done" file))
282 (error
283 (gnus-message
284 1
285 "The Gnus registry could not be loaded from %s, creating a new one"
286 file)
287 (gnus-registry-remake-db t)))))
288
289(defun gnus-registry-save (&optional file db)
23f87bed
MB
290 "Save the registry cache file."
291 (interactive)
11a3174d
TZ
292 (let ((file (or file gnus-registry-cache-file))
293 (db (or db gnus-registry-db)))
294 (gnus-message 5 "Saving Gnus registry (%d entries) to %s..."
295 (registry-size db) file)
296 (registry-prune db)
297 ;; TODO: call (gnus-string-remove-all-properties v) on all elements?
298 (eieio-persistent-save db file)
299 (gnus-message 5 "Saving Gnus registry (size %d) to %s...done"
300 (registry-size db) file)))
301
302;; article move/copy/spool/delete actions
23f87bed
MB
303(defun gnus-registry-action (action data-header from &optional to method)
304 (let* ((id (mail-header-id data-header))
d515dc24 305 (subject (mail-header-subject data-header))
8d6d9c8f
KY
306 (recipients (gnus-registry-sort-addresses
307 (or (ignore-errors (mail-header "Cc" data-header)) "")
308 (or (ignore-errors (mail-header "To" data-header)) "")))
cf8b0c27
TZ
309 (sender (nth 0 (gnus-registry-extract-addresses
310 (mail-header-from data-header))))
11a3174d
TZ
311 (from (gnus-group-guess-full-name-from-command-method from))
312 (to (if to (gnus-group-guess-full-name-from-command-method to) nil))
313 (to-name (if to to "the Bit Bucket")))
314 (gnus-message 7 "Gnus registry: article %s %s from %s to %s"
315 id (if method "respooling" "going") from to)
316
317 (gnus-registry-handle-action
318 id
319 ;; unless copying, remove the old "from" group
320 (if (not (equal 'copy action)) from nil)
cf8b0c27 321 to subject sender recipients)))
23f87bed 322
cf8b0c27 323(defun gnus-registry-spool-action (id group &optional subject sender recipients)
d515dc24 324 (let ((to (gnus-group-guess-full-name-from-command-method group))
cf8b0c27 325 (recipients (or recipients
8d6d9c8f
KY
326 (gnus-registry-sort-addresses
327 (or (message-fetch-field "cc") "")
328 (or (message-fetch-field "to") ""))))
d515dc24
TZ
329 (subject (or subject (message-fetch-field "subject")))
330 (sender (or sender (message-fetch-field "from"))))
23f87bed
MB
331 (when (and (stringp id) (string-match "\r$" id))
332 (setq id (substring id 0 -1)))
11a3174d
TZ
333 (gnus-message 7 "Gnus registry: article %s spooled to %s"
334 id
335 to)
cf8b0c27 336 (gnus-registry-handle-action id nil to subject sender recipients)))
11a3174d 337
cf8b0c27
TZ
338(defun gnus-registry-handle-action (id from to subject sender
339 &optional recipients)
4523dc7f
G
340 (gnus-message
341 10
cf8b0c27 342 "gnus-registry-handle-action %S" (list id from to subject sender recipients))
11a3174d
TZ
343 (let ((db gnus-registry-db)
344 ;; safe if not found
d515dc24
TZ
345 (entry (gnus-registry-get-or-make-entry id))
346 (subject (gnus-string-remove-all-properties
347 (gnus-registry-simplify-subject subject)))
348 (sender (gnus-string-remove-all-properties sender)))
11a3174d
TZ
349
350 ;; this could be done by calling `gnus-registry-set-id-key'
351 ;; several times but it's better to bunch the transactions
352 ;; together
353
354 (registry-delete db (list id) nil)
355 (when from
356 (setq entry (cons (delete from (assoc 'group entry))
357 (assq-delete-all 'group entry))))
358
cf8b0c27
TZ
359 (dolist (kv `((group ,to)
360 (sender ,sender)
361 (recipient ,@recipients)
362 (subject ,subject)))
11a3174d
TZ
363 (when (second kv)
364 (let ((new (or (assq (first kv) entry)
365 (list (first kv)))))
cf8b0c27
TZ
366 (dolist (toadd (cdr kv))
367 (add-to-list 'new toadd t))
11a3174d
TZ
368 (setq entry (cons new
369 (assq-delete-all (first kv) entry))))))
370 (gnus-message 10 "Gnus registry: new entry for %s is %S"
371 id
372 entry)
373 (registry-insert db id entry)))
23f87bed
MB
374
375;; Function for nn{mail|imap}-split-fancy: look up all references in
376;; the cache and if a match is found, return that group.
377(defun gnus-registry-split-fancy-with-parent ()
378 "Split this message into the same group as its parent. The parent
379is obtained from the registry. This function can be used as an entry
380in `nnmail-split-fancy' or `nnimap-split-fancy', for example like
bf247b6e 381this: (: gnus-registry-split-fancy-with-parent)
23f87bed 382
01c52d31
MB
383This function tracks ALL backends, unlike
384`nnmail-split-fancy-with-parent' which tracks only nnmail
385messages.
386
23f87bed 387For a message to be split, it looks for the parent message in the
01c52d31
MB
388References or In-Reply-To header and then looks in the registry
389to see which group that message was put in. This group is
14e8de0c
MB
390returned, unless `gnus-registry-follow-group-p' return nil for
391that group.
23f87bed
MB
392
393See the Info node `(gnus)Fancy Mail Splitting' for more details."
14e8de0c 394 (let* ((refstr (or (message-fetch-field "references") "")) ; guaranteed
11a3174d
TZ
395 (reply-to (message-fetch-field "in-reply-to")) ; may be nil
396 ;; now, if reply-to is valid, append it to the References
397 (refstr (if reply-to
398 (concat refstr " " reply-to)
399 refstr))
400 (references (and refstr (gnus-extract-references refstr)))
401 ;; these may not be used, but the code is cleaner having them up here
402 (sender (gnus-string-remove-all-properties
403 (message-fetch-field "from")))
8d6d9c8f
KY
404 (recipients (gnus-registry-sort-addresses
405 (or (message-fetch-field "cc") "")
406 (or (message-fetch-field "to") "")))
11a3174d
TZ
407 (subject (gnus-string-remove-all-properties
408 (gnus-registry-simplify-subject
409 (message-fetch-field "subject"))))
410
411 (nnmail-split-fancy-with-parent-ignore-groups
412 (if (listp nnmail-split-fancy-with-parent-ignore-groups)
413 nnmail-split-fancy-with-parent-ignore-groups
414 (list nnmail-split-fancy-with-parent-ignore-groups))))
415 (gnus-registry--split-fancy-with-parent-internal
416 :references references
417 :refstr refstr
418 :sender sender
cf8b0c27 419 :recipients recipients
11a3174d
TZ
420 :subject subject
421 :log-agent "Gnus registry fancy splitting with parent")))
422
423(defun* gnus-registry--split-fancy-with-parent-internal
424 (&rest spec
cf8b0c27 425 &key references refstr sender subject recipients log-agent
11a3174d
TZ
426 &allow-other-keys)
427 (gnus-message
428 10
2237da9c 429 "gnus-registry--split-fancy-with-parent-internal %S" spec)
11a3174d
TZ
430 (let ((db gnus-registry-db)
431 found)
2237da9c 432 ;; this is a big chain of statements. it uses
14e8de0c
MB
433 ;; gnus-registry-post-process-groups to filter the results after
434 ;; every step.
2237da9c
G
435 ;; the references string must be valid and parse to valid references
436 (when references
437 (gnus-message
438 9
439 "%s is tracing references %s"
440 log-agent refstr)
11a3174d 441 (dolist (reference (nreverse references))
2237da9c
G
442 (gnus-message 9 "%s is looking up %s" log-agent reference)
443 (loop for group in (gnus-registry-get-id-key reference 'group)
444 when (gnus-registry-follow-group-p group)
445 do (gnus-message 7 "%s traced %s to %s" log-agent reference group)
446 do (push group found)))
14e8de0c 447 ;; filter the found groups and return them
58a67d68 448 ;; the found groups are the full groups
c9fc72fa 449 (setq found (gnus-registry-post-process-groups
11a3174d
TZ
450 "references" refstr found)))
451
ba3bd5b6
TZ
452 ;; else: there were no matches, now try the extra tracking by subject
453 (when (and (null found)
454 (memq 'subject gnus-registry-track-extra)
455 subject
456 (< gnus-registry-minimum-subject-length (length subject)))
457 (let ((groups (apply
458 'append
459 (mapcar
460 (lambda (reference)
461 (gnus-registry-get-id-key reference 'group))
462 (registry-lookup-secondary-value db 'subject subject)))))
463 (setq found
464 (loop for group in groups
465 when (gnus-registry-follow-group-p group)
466 do (gnus-message
467 ;; warn more if gnus-registry-track-extra
468 (if gnus-registry-track-extra 7 9)
469 "%s (extra tracking) traced subject '%s' to %s"
470 log-agent subject group)
471 collect group))
472 ;; filter the found groups and return them
473 ;; the found groups are NOT the full groups
474 (setq found (gnus-registry-post-process-groups
475 "subject" subject found))))
476
11a3174d 477 ;; else: there were no matches, try the extra tracking by sender
2237da9c
G
478 (when (and (null found)
479 (memq 'sender gnus-registry-track-extra)
480 sender
1e3b6001
G
481 (not (gnus-grep-in-list
482 sender
483 gnus-registry-unfollowed-addresses)))
2237da9c
G
484 (let ((groups (apply
485 'append
486 (mapcar
487 (lambda (reference)
488 (gnus-registry-get-id-key reference 'group))
489 (registry-lookup-secondary-value db 'sender sender)))))
490 (setq found
491 (loop for group in groups
492 when (gnus-registry-follow-group-p group)
493 do (gnus-message
494 ;; warn more if gnus-registry-track-extra
495 (if gnus-registry-track-extra 7 9)
496 "%s (extra tracking) traced sender '%s' to %s"
497 log-agent sender group)
498 collect group)))
499
500 ;; filter the found groups and return them
501 ;; the found groups are NOT the full groups
502 (setq found (gnus-registry-post-process-groups
503 "sender" sender found)))
c9fc72fa 504
cf8b0c27
TZ
505 ;; else: there were no matches, try the extra tracking by recipient
506 (when (and (null found)
507 (memq 'recipient gnus-registry-track-extra)
508 recipients)
509 (dolist (recp recipients)
510 (when (and (null found)
511 (not (gnus-grep-in-list
512 recp
513 gnus-registry-unfollowed-addresses)))
514 (let ((groups (apply 'append
515 (mapcar
516 (lambda (reference)
517 (gnus-registry-get-id-key reference 'group))
518 (registry-lookup-secondary-value
519 db 'recipient recp)))))
520 (setq found
521 (loop for group in groups
522 when (gnus-registry-follow-group-p group)
523 do (gnus-message
524 ;; warn more if gnus-registry-track-extra
525 (if gnus-registry-track-extra 7 9)
526 "%s (extra tracking) traced recipient '%s' to %s"
527 log-agent recp group)
528 collect group)))))
529
530 ;; filter the found groups and return them
531 ;; the found groups are NOT the full groups
532 (setq found (gnus-registry-post-process-groups
533 "recipients" (mapconcat 'identity recipients ", ") found)))
534
2237da9c
G
535 ;; after the (cond) we extract the actual value safely
536 (car-safe found)))
14e8de0c 537
11a3174d
TZ
538(defun gnus-registry-post-process-groups (mode key groups)
539 "Inspects GROUPS found by MODE for KEY to determine which ones to follow.
14e8de0c
MB
540
541MODE can be 'subject' or 'sender' for example. The KEY is the
542value by which MODE was searched.
543
544Transforms each group name to the equivalent short name.
545
546Checks if the current Gnus method (from `gnus-command-method' or
547from `gnus-newsgroup-name') is the same as the group's method.
11a3174d 548Foreign methods are not supported so they are rejected.
14e8de0c
MB
549
550Reduces the list to a single group, or complains if that's not
11a3174d 551possible. Uses `gnus-registry-split-strategy'."
14e8de0c 552 (let ((log-agent "gnus-registry-post-process-group")
2237da9c
G
553 (desc (format "%d groups" (length groups)))
554 out chosen)
555 ;; the strategy can be nil, in which case chosen is nil
556 (setq chosen
11a3174d 557 (case gnus-registry-split-strategy
2237da9c
G
558 ;; default, take only one-element lists into chosen
559 ((nil)
560 (and (= (length groups) 1)
561 (car-safe groups)))
562
11a3174d 563 ((first)
2237da9c 564 (car-safe groups))
11a3174d
TZ
565
566 ((majority)
567 (let ((freq (make-hash-table
568 :size 256
569 :test 'equal)))
2237da9c
G
570 (mapc (lambda (x) (let ((x (gnus-group-short-name x)))
571 (puthash x (1+ (gethash x freq 0)) freq)))
11a3174d 572 groups)
2237da9c
G
573 (setq desc (format "%d groups, %d unique"
574 (length groups)
575 (hash-table-count freq)))
576 (car-safe
577 (sort groups
578 (lambda (a b)
579 (> (gethash (gnus-group-short-name a) freq 0)
580 (gethash (gnus-group-short-name b) freq 0)))))))))
581
582 (if chosen
583 (gnus-message
584 9
585 "%s: strategy %s on %s produced %s"
586 log-agent gnus-registry-split-strategy desc chosen)
587 (gnus-message
588 9
589 "%s: strategy %s on %s did not produce an answer"
590 log-agent
591 (or gnus-registry-split-strategy "default")
592 desc))
593
594 (setq groups (and chosen (list chosen)))
11a3174d
TZ
595
596 (dolist (group groups)
597 (let ((m1 (gnus-find-method-for-group group))
598 (m2 (or gnus-command-method
599 (gnus-find-method-for-group gnus-newsgroup-name)))
600 (short-name (gnus-group-short-name group)))
601 (if (gnus-methods-equal-p m1 m2)
602 (progn
603 ;; this is REALLY just for debugging
2237da9c
G
604 (when (not (equal group short-name))
605 (gnus-message
606 10
607 "%s: stripped group %s to %s"
608 log-agent group short-name))
11a3174d
TZ
609 (add-to-list 'out short-name))
610 ;; else...
611 (gnus-message
612 7
2237da9c 613 "%s: ignored foreign group %s"
11a3174d
TZ
614 log-agent group))))
615
2237da9c
G
616 (setq out (delq nil out))
617
11a3174d
TZ
618 (cond
619 ((= (length out) 1) out)
620 ((null out)
621 (gnus-message
622 5
1e3b6001
G
623 "%s: no matches for %s '%s'."
624 log-agent mode key)
11a3174d
TZ
625 nil)
626 (t (gnus-message
627 5
1e3b6001 628 "%s: too many extra matches (%s) for %s '%s'. Returning none."
11a3174d
TZ
629 log-agent out mode key)
630 nil))))
14e8de0c
MB
631
632(defun gnus-registry-follow-group-p (group)
633 "Determines if a group name should be followed.
634Consults `gnus-registry-unfollowed-groups' and
635`nnmail-split-fancy-with-parent-ignore-groups'."
11a3174d
TZ
636 (and group
637 (not (or (gnus-grep-in-list
638 group
639 gnus-registry-unfollowed-groups)
640 (gnus-grep-in-list
641 group
642 nnmail-split-fancy-with-parent-ignore-groups)))))
23f87bed 643
01c52d31 644(defun gnus-registry-wash-for-keywords (&optional force)
11a3174d
TZ
645 "Get the keywords of the current article.
646Overrides existing keywords with FORCE set non-nil."
01c52d31
MB
647 (interactive)
648 (let ((id (gnus-registry-fetch-message-id-fast gnus-current-article))
11a3174d
TZ
649 word words)
650 (if (or (not (gnus-registry-get-id-key id 'keyword))
651 force)
652 (with-current-buffer gnus-article-buffer
653 (article-goto-body)
654 (save-window-excursion
655 (save-restriction
656 (narrow-to-region (point) (point-max))
657 (with-syntax-table gnus-adaptive-word-syntax-table
658 (while (re-search-forward "\\b\\w+\\b" nil t)
659 (setq word (gnus-string-remove-all-properties
660 (downcase (buffer-substring
661 (match-beginning 0) (match-end 0)))))
662 (if (> (length word) 2)
663 (push word words))))))
664 (gnus-registry-set-id-key id 'keyword words)))))
665
666(defun gnus-registry-keywords ()
667 (let ((table (registry-lookup-secondary gnus-registry-db 'keyword)))
668 (when table (maphash (lambda (k v) k) table))))
01c52d31
MB
669
670(defun gnus-registry-find-keywords (keyword)
11a3174d
TZ
671 (interactive (list
672 (completing-read "Keyword: " (gnus-registry-keywords) nil t)))
673 (registry-lookup-secondary-value gnus-registry-db 'keyword keyword))
01c52d31 674
23f87bed
MB
675(defun gnus-registry-register-message-ids ()
676 "Register the Message-ID of every article in the group"
677 (unless (gnus-parameter-registry-ignore gnus-newsgroup-name)
678 (dolist (article gnus-newsgroup-articles)
11a3174d
TZ
679 (let* ((id (gnus-registry-fetch-message-id-fast article))
680 (groups (gnus-registry-get-id-key id 'group)))
681 (unless (member gnus-newsgroup-name groups)
682 (gnus-message 9 "Registry: Registering article %d with group %s"
683 article gnus-newsgroup-name)
684 (gnus-registry-handle-action id nil gnus-newsgroup-name
685 (gnus-registry-fetch-simplified-message-subject-fast article)
cf8b0c27
TZ
686 (gnus-registry-fetch-sender-fast article)
687 (gnus-registry-fetch-recipients-fast article)))))))
11a3174d
TZ
688
689;; message field fetchers
23f87bed
MB
690(defun gnus-registry-fetch-message-id-fast (article)
691 "Fetch the Message-ID quickly, using the internal gnus-data-list function"
692 (if (and (numberp article)
11a3174d 693 (assoc article (gnus-data-list nil)))
23f87bed
MB
694 (mail-header-id (gnus-data-header (assoc article (gnus-data-list nil))))
695 nil))
696
cf8b0c27
TZ
697(defun gnus-registry-extract-addresses (text)
698 "Extract all the addresses in a normalized way from TEXT.
699Returns an unsorted list of strings in the name <address> format.
700Addresses without a name will say \"noname\"."
701 (mapcar (lambda (add)
702 (gnus-string-remove-all-properties
703 (let* ((name (or (nth 0 add) "noname"))
704 (addr (nth 1 add))
705 (addr (if (bufferp addr)
706 (with-current-buffer addr
707 (buffer-string))
708 addr)))
709 (format "%s <%s>" name addr))))
710 (mail-extract-address-components text t)))
711
8d6d9c8f
KY
712(defun gnus-registry-sort-addresses (&rest addresses)
713 "Return a normalized and sorted list of ADDRESSES."
714 (sort (apply 'nconc (mapcar 'gnus-registry-extract-addresses addresses))
715 'string-lessp))
716
23f87bed
MB
717(defun gnus-registry-simplify-subject (subject)
718 (if (stringp subject)
719 (gnus-simplify-subject subject)
720 nil))
721
722(defun gnus-registry-fetch-simplified-message-subject-fast (article)
723 "Fetch the Subject quickly, using the internal gnus-data-list function"
724 (if (and (numberp article)
11a3174d 725 (assoc article (gnus-data-list nil)))
01c52d31
MB
726 (gnus-string-remove-all-properties
727 (gnus-registry-simplify-subject
11a3174d
TZ
728 (mail-header-subject (gnus-data-header
729 (assoc article (gnus-data-list nil))))))
23f87bed
MB
730 nil))
731
732(defun gnus-registry-fetch-sender-fast (article)
cf8b0c27
TZ
733 (gnus-registry-fetch-header-fast "from" article))
734
735(defun gnus-registry-fetch-recipients-fast (article)
8d6d9c8f
KY
736 (gnus-registry-sort-addresses
737 (or (ignore-errors (gnus-registry-fetch-header-fast "Cc" article)) "")
738 (or (ignore-errors (gnus-registry-fetch-header-fast "To" article)) "")))
cf8b0c27
TZ
739
740(defun gnus-registry-fetch-header-fast (article header)
741 "Fetch the HEADER quickly, using the internal gnus-data-list function"
23f87bed 742 (if (and (numberp article)
11a3174d 743 (assoc article (gnus-data-list nil)))
01c52d31 744 (gnus-string-remove-all-properties
cf8b0c27
TZ
745 (mail-header header (gnus-data-header
746 (assoc article (gnus-data-list nil)))))
23f87bed
MB
747 nil))
748
11a3174d 749;; registry marks glue
14e8de0c
MB
750(defun gnus-registry-do-marks (type function)
751 "For each known mark, call FUNCTION for each cell of type TYPE.
752
753FUNCTION should take two parameters, a mark symbol and the cell value."
754 (dolist (mark-info gnus-registry-marks)
8f7abae3 755 (let* ((mark (car-safe mark-info))
11a3174d
TZ
756 (data (cdr-safe mark-info))
757 (cell-data (plist-get data type)))
8f7abae3 758 (when cell-data
11a3174d 759 (funcall function mark cell-data)))))
14e8de0c
MB
760
761;;; this is ugly code, but I don't know how to do it better
8f7abae3 762(defun gnus-registry-install-shortcuts ()
14e8de0c
MB
763 "Install the keyboard shortcuts and menus for the registry.
764Uses `gnus-registry-marks' to find what shortcuts to install."
8f7abae3 765 (let (keys-plist)
ec7995fa
KY
766 (setq gnus-registry-misc-menus nil)
767 (gnus-registry-do-marks
8f7abae3
MB
768 :char
769 (lambda (mark data)
770 (let ((function-format
11a3174d 771 (format "gnus-registry-%%s-article-%s-mark" mark)))
14e8de0c
MB
772
773;;; The following generates these functions:
774;;; (defun gnus-registry-set-article-Important-mark (&rest articles)
775;;; "Apply the Important mark to process-marked ARTICLES."
776;;; (interactive (gnus-summary-work-articles current-prefix-arg))
777;;; (gnus-registry-set-article-mark-internal 'Important articles nil t))
778;;; (defun gnus-registry-remove-article-Important-mark (&rest articles)
779;;; "Apply the Important mark to process-marked ARTICLES."
780;;; (interactive (gnus-summary-work-articles current-prefix-arg))
781;;; (gnus-registry-set-article-mark-internal 'Important articles t t))
782
11a3174d
TZ
783 (dolist (remove '(t nil))
784 (let* ((variant-name (if remove "remove" "set"))
785 (function-name (format function-format variant-name))
786 (shortcut (format "%c" data))
787 (shortcut (if remove (upcase shortcut) shortcut)))
788 (unintern function-name obarray)
789 (eval
790 `(defun
791 ;; function name
792 ,(intern function-name)
793 ;; parameter definition
794 (&rest articles)
795 ;; documentation
796 ,(format
797 "%s the %s mark over process-marked ARTICLES."
798 (upcase-initials variant-name)
799 mark)
800 ;; interactive definition
801 (interactive
802 (gnus-summary-work-articles current-prefix-arg))
803 ;; actual code
804
805 ;; if this is called and the user doesn't want the
806 ;; registry enabled, we'll ask anyhow
807 (when (eq gnus-registry-install nil)
808 (setq gnus-registry-install 'ask))
809
810 ;; now the user is asked if gnus-registry-install is 'ask
811 (when (gnus-registry-install-p)
812 (gnus-registry-set-article-mark-internal
813 ;; all this just to get the mark, I must be doing it wrong
814 (intern ,(symbol-name mark))
815 articles ,remove t)
816 (gnus-message
817 9
818 "Applying mark %s to %d articles"
819 ,(symbol-name mark) (length articles))
820 (dolist (article articles)
821 (gnus-summary-update-article
822 article
823 (assoc article (gnus-data-list nil)))))))
824 (push (intern function-name) keys-plist)
825 (push shortcut keys-plist)
826 (push (vector (format "%s %s"
827 (upcase-initials variant-name)
828 (symbol-name mark))
829 (intern function-name) t)
830 gnus-registry-misc-menus)
831 (gnus-message
832 9
833 "Defined mark handling function %s"
834 function-name))))))
8f7abae3 835 (gnus-define-keys-1
ec7995fa
KY
836 '(gnus-registry-mark-map "M" gnus-summary-mark-map)
837 keys-plist)
838 (add-hook 'gnus-summary-menu-hook
11a3174d
TZ
839 (lambda ()
840 (easy-menu-add-item
841 gnus-summary-misc-menu
842 nil
843 (cons "Registry Marks" gnus-registry-misc-menus))))))
8f7abae3
MB
844
845;;; use like this:
c9fc72fa 846;;; (defalias 'gnus-user-format-function-M
8f7abae3
MB
847;;; 'gnus-registry-user-format-function-M)
848(defun gnus-registry-user-format-function-M (headers)
849 (let* ((id (mail-header-message-id headers))
11a3174d
TZ
850 (marks (when id (gnus-registry-get-id-key id 'mark))))
851 (apply 'concat (mapcar (lambda (mark)
852 (let ((c
853 (plist-get
854 (cdr-safe
855 (assoc mark gnus-registry-marks))
856 :char)))
857 (if c
858 (list c)
859 nil)))
860 marks))))
0b6799c3
MB
861
862(defun gnus-registry-read-mark ()
863 "Read a mark name from the user with completion."
229b59da
G
864 (let ((mark (gnus-completing-read
865 "Label"
866 (mapcar 'symbol-name (mapcar 'car gnus-registry-marks))
867 nil nil nil
11a3174d 868 (symbol-name gnus-registry-default-mark))))
0b6799c3
MB
869 (when (stringp mark)
870 (intern mark))))
871
872(defun gnus-registry-set-article-mark (&rest articles)
873 "Apply a mark to process-marked ARTICLES."
874 (interactive (gnus-summary-work-articles current-prefix-arg))
11a3174d
TZ
875 (gnus-registry-set-article-mark-internal (gnus-registry-read-mark)
876 articles nil t))
0b6799c3
MB
877
878(defun gnus-registry-remove-article-mark (&rest articles)
879 "Remove a mark from process-marked ARTICLES."
880 (interactive (gnus-summary-work-articles current-prefix-arg))
11a3174d
TZ
881 (gnus-registry-set-article-mark-internal (gnus-registry-read-mark)
882 articles t t))
883
884(defun gnus-registry-set-article-mark-internal (mark
885 articles
886 &optional remove
887 show-message)
888 "Apply or remove MARK across a list of ARTICLES."
0b6799c3 889 (let ((article-id-list
11a3174d 890 (mapcar 'gnus-registry-fetch-message-id-fast articles)))
0b6799c3 891 (dolist (id article-id-list)
11a3174d
TZ
892 (let* ((marks (delq mark (gnus-registry-get-id-key id 'mark)))
893 (marks (if remove marks (cons mark marks))))
894 (when show-message
895 (gnus-message 1 "%s mark %s with message ID %s, resulting in %S"
896 (if remove "Removing" "Adding")
897 mark id marks))
898 (gnus-registry-set-id-key id 'mark marks)))))
0b6799c3
MB
899
900(defun gnus-registry-get-article-marks (&rest articles)
901 "Get the Gnus registry marks for ARTICLES and show them if interactive.
902Uses process/prefix conventions. For multiple articles,
903only the last one's marks are returned."
904 (interactive (gnus-summary-work-articles 1))
11a3174d
TZ
905 (let* ((article (last articles))
906 (id (gnus-registry-fetch-message-id-fast article))
907 (marks (when id (gnus-registry-get-id-key id 'mark))))
0b6799c3 908 (when (interactive-p)
11a3174d 909 (gnus-message 1 "Marks are %S" marks))
0b6799c3
MB
910 marks))
911
23f87bed
MB
912(defun gnus-registry-group-count (id)
913 "Get the number of groups of a message, based on the message ID."
11a3174d
TZ
914 (length (gnus-registry-get-id-key id 'group)))
915
916(defun gnus-registry-get-or-make-entry (id)
917 (let* ((db gnus-registry-db)
918 ;; safe if not found
919 (entries (registry-lookup db (list id))))
920
921 (when (null entries)
922 (registry-insert db id (list (list 'creation-time (current-time))
923 '(group) '(sender) '(subject)))
924 (setq entries (registry-lookup db (list id))))
925
926 (nth 1 (assoc id entries))))
927
42b23765
TZ
928(defun gnus-registry-delete-entries (idlist)
929 (registry-delete gnus-registry-db idlist nil))
930
11a3174d
TZ
931(defun gnus-registry-get-id-key (id key)
932 (cdr-safe (assq key (gnus-registry-get-or-make-entry id))))
933
934(defun gnus-registry-set-id-key (id key vals)
935 (let* ((db gnus-registry-db)
936 (entry (gnus-registry-get-or-make-entry id)))
937 (registry-delete db (list id) nil)
938 (setq entry (cons (cons key vals) (assq-delete-all key entry)))
939 (registry-insert db id entry)
940 entry))
941
42b23765
TZ
942(defun gnus-registry-import-eld (file)
943 (interactive "fOld registry file to import? ")
944 ;; example content:
945 ;; (setq gnus-registry-alist '(
946 ;; ("<messageID>" ((marks nil)
947 ;; (mtime 19365 1776 440496)
948 ;; (sender . "root (Cron Daemon)")
949 ;; (subject . "Cron"))
950 ;; "cron" "nnml+private:cron")
951 (load file t)
952 (when (boundp 'gnus-registry-alist)
953 (let* ((old (symbol-value 'gnus-registry-alist))
954 (count 0)
955 (expected (length old))
956 entry)
957 (while (car-safe old)
958 (incf count)
959 ;; don't use progress reporters for backwards compatibility
960 (when (and (< 0 expected)
961 (= 0 (mod count 100)))
962 (message "importing: %d of %d (%.2f%%)"
963 count expected (/ (* 100 count) expected)))
964 (setq entry (car-safe old)
965 old (cdr-safe old))
966 (let* ((id (car-safe entry))
967 (new-entry (gnus-registry-get-or-make-entry id))
968 (rest (cdr-safe entry))
969 (groups (loop for p in rest
970 when (stringp p)
971 collect p))
972 extra-cell key val)
973 ;; remove all the strings from the entry
8d6d9c8f
KY
974 (dolist (elem rest)
975 (if (stringp elem) (setq rest (delq elem rest))))
42b23765
TZ
976 (gnus-registry-set-id-key id 'group groups)
977 ;; just use the first extra element
978 (setq rest (car-safe rest))
979 (while (car-safe rest)
980 (setq extra-cell (car-safe rest)
981 key (car-safe extra-cell)
982 val (cdr-safe extra-cell)
983 rest (cdr-safe rest))
984 (when (and val (atom val))
985 (setq val (list val)))
986 (gnus-registry-set-id-key id key val))))
987 (message "Import done, collected %d entries" count))))
11a3174d 988
cf8b0c27
TZ
989(ert-deftest gnus-registry-misc-test ()
990 (should-error (gnus-registry-extract-addresses '("" "")))
991
992 (should (equal '("Ted Zlatanov <tzz@lifelogs.com>"
993 "noname <ed@you.me>"
994 "noname <cyd@stupidchicken.com>"
995 "noname <tzz@lifelogs.com>")
996 (gnus-registry-extract-addresses
997 (concat "Ted Zlatanov <tzz@lifelogs.com>, "
998 "ed <ed@you.me>, " ; "ed" is not a valid name here
999 "cyd@stupidchicken.com, "
1000 "tzz@lifelogs.com")))))
1001
11a3174d
TZ
1002(ert-deftest gnus-registry-usage-test ()
1003 (let* ((n 100)
1004 (tempfile (make-temp-file "gnus-registry-persist"))
1005 (db (gnus-registry-make-db tempfile))
1006 (gnus-registry-db db)
1007 back size)
1008 (message "Adding %d keys to the test Gnus registry" n)
1009 (dotimes (i n)
1010 (let ((id (number-to-string i)))
1011 (gnus-registry-handle-action id
1012 (if (>= 50 i) "fromgroup" nil)
1013 "togroup"
1014 (when (>= 70 i)
1015 (format "subject %d" (mod i 10)))
1016 (when (>= 80 i)
1017 (format "sender %d" (mod i 10))))))
1018 (message "Testing Gnus registry size is %d" n)
1019 (should (= n (registry-size db)))
1020 (message "Looking up individual keys (registry-lookup)")
1021 (should (equal (loop for e
1022 in (mapcar 'cadr
1023 (registry-lookup db '("20" "83" "72")))
1024 collect (assq 'subject e)
1025 collect (assq 'sender e)
1026 collect (assq 'group e))
1027 '((subject "subject 0") (sender "sender 0") (group "togroup")
1028 (subject) (sender) (group "togroup")
1029 (subject) (sender "sender 2") (group "togroup"))))
1030
1031 (message "Looking up individual keys (gnus-registry-id-key)")
1032 (should (equal (gnus-registry-get-id-key "34" 'group) '("togroup")))
1033 (should (equal (gnus-registry-get-id-key "34" 'subject) '("subject 4")))
1034 (message "Trying to insert a duplicate key")
1035 (should-error (registry-insert db "55" '()))
1036 (message "Looking up individual keys (gnus-registry-get-or-make-entry)")
1037 (should (gnus-registry-get-or-make-entry "22"))
1038 (message "Saving the Gnus registry to %s" tempfile)
1039 (should (gnus-registry-save tempfile db))
1040 (setq size (nth 7 (file-attributes tempfile)))
1041 (message "Saving the Gnus registry to %s: size %d" tempfile size)
1042 (should (< 0 size))
1043 (with-temp-buffer
1044 (insert-file-contents-literally tempfile)
1045 (should (looking-at (concat ";; Object "
1046 "Gnus Registry"
1047 "\n;; EIEIO PERSISTENT OBJECT"))))
1048 (message "Reading Gnus registry back")
1049 (setq back (eieio-persistent-read tempfile))
1050 (should back)
1051 (message "Read Gnus registry back: %d keys, expected %d==%d"
1052 (registry-size back) n (registry-size db))
1053 (should (= (registry-size back) n))
1054 (should (= (registry-size back) (registry-size db)))
1055 (delete-file tempfile)
1056 (message "Pruning Gnus registry to 0 by setting :max-soft")
1057 (oset db :max-soft 0)
1058 (registry-prune db)
1059 (should (= (registry-size db) 0)))
1060 (message "Done with Gnus registry usage testing."))
23f87bed
MB
1061
1062;;;###autoload
1063(defun gnus-registry-initialize ()
8f7abae3 1064"Initialize the Gnus registry."
23f87bed 1065 (interactive)
8f7abae3 1066 (gnus-message 5 "Initializing the registry")
11a3174d 1067 (setq gnus-registry-install t) ; in case it was 'ask or nil
23f87bed 1068 (gnus-registry-install-hooks)
8f7abae3 1069 (gnus-registry-install-shortcuts)
23f87bed
MB
1070 (gnus-registry-read))
1071
1072;;;###autoload
1073(defun gnus-registry-install-hooks ()
1074 "Install the registry hooks."
1075 (interactive)
bf247b6e 1076 (add-hook 'gnus-summary-article-move-hook 'gnus-registry-action)
23f87bed
MB
1077 (add-hook 'gnus-summary-article-delete-hook 'gnus-registry-action)
1078 (add-hook 'gnus-summary-article-expire-hook 'gnus-registry-action)
1079 (add-hook 'nnmail-spool-hook 'gnus-registry-spool-action)
bf247b6e 1080
23f87bed
MB
1081 (add-hook 'gnus-save-newsrc-hook 'gnus-registry-save)
1082 (add-hook 'gnus-read-newsrc-el-hook 'gnus-registry-read)
1083
1084 (add-hook 'gnus-summary-prepare-hook 'gnus-registry-register-message-ids))
1085
1086(defun gnus-registry-unload-hook ()
1087 "Uninstall the registry hooks."
1088 (interactive)
bf247b6e 1089 (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action)
23f87bed
MB
1090 (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action)
1091 (remove-hook 'gnus-summary-article-expire-hook 'gnus-registry-action)
1092 (remove-hook 'nnmail-spool-hook 'gnus-registry-spool-action)
bf247b6e 1093
23f87bed
MB
1094 (remove-hook 'gnus-save-newsrc-hook 'gnus-registry-save)
1095 (remove-hook 'gnus-read-newsrc-el-hook 'gnus-registry-read)
1096
1097 (remove-hook 'gnus-summary-prepare-hook 'gnus-registry-register-message-ids))
1098
6d52545d
RS
1099(add-hook 'gnus-registry-unload-hook 'gnus-registry-unload-hook)
1100
8f7abae3
MB
1101(defun gnus-registry-install-p ()
1102 (interactive)
1103 (when (eq gnus-registry-install 'ask)
1104 (setq gnus-registry-install
11a3174d
TZ
1105 (gnus-y-or-n-p
1106 (concat "Enable the Gnus registry? "
1107 "See the variable `gnus-registry-install' "
1108 "to get rid of this query permanently. ")))
8f7abae3
MB
1109 (when gnus-registry-install
1110 ;; we just set gnus-registry-install to t, so initialize the registry!
1111 (gnus-registry-initialize)))
1112;;; we could call it here: (customize-variable 'gnus-registry-install)
1113 gnus-registry-install)
1114
8f7abae3 1115;; TODO: a few things
23f87bed
MB
1116
1117(provide 'gnus-registry)
1118
23f87bed 1119;;; gnus-registry.el ends here