annotate lisp/gnus/gnus-registry.el @ 111395:969fb8574065

shr.el (shr-tag-img): Use string-width and truncate-string-to-width to measure the length and truncate alt text.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 04 Nov 2010 11:00:25 +0000
parents fc6dc700cc9f
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1 ;;; gnus-registry.el --- article registry for Gnus
64754
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
2
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
3 ;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
94748
e6e8d9b7ab7d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
4 ;;; Free Software Foundation, Inc.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
5
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
6 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
94748
e6e8d9b7ab7d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
7 ;; Keywords: news registry
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
8
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
10
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94451
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94451
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94451
diff changeset
14 ;; (at your option) any later version.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
15
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94451
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
20
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94451
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
23
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
24 ;;; Commentary:
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
25
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
26 ;; This is the gnus-registry.el package, which works with all
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
27 ;; backends, not just nnmail (e.g. NNTP). The major issue is that it
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
28 ;; doesn't go across backends, so for instance if an article is in
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
29 ;; nnml:sys and you see a reference to it in nnimap splitting, the
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
30 ;; article will end up in nnimap:sys
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
31
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
32 ;; gnus-registry.el intercepts article respooling, moving, deleting,
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
33 ;; and copying for all backends. If it doesn't work correctly for
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
34 ;; you, submit a bug report and I'll be glad to fix it. It needs
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
35 ;; documentation in the manual (also on my to-do list).
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
36
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
37 ;; Put this in your startup file (~/.gnus.el for instance)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
38
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
39 ;; (setq gnus-registry-max-entries 2500
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
40 ;; gnus-registry-use-long-group-names t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
41
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
42 ;; (gnus-registry-initialize)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
43
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
44 ;; Then use this in your fancy-split:
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
45
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
46 ;; (: gnus-registry-split-fancy-with-parent)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
47
110859
7aa4fdb60d57 shr.el (shr-insert): Don't insert double spaces.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110772
diff changeset
48 ;; You should also consider using the nnregistry backend to look up
7aa4fdb60d57 shr.el (shr-insert): Don't insert double spaces.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110772
diff changeset
49 ;; articles. See the Gnus manual for more information.
7aa4fdb60d57 shr.el (shr-insert): Don't insert double spaces.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110772
diff changeset
50
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
51 ;; TODO:
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
52
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
53 ;; - get the correct group on spool actions
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
54
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
55 ;; - articles that are spooled to a different backend should be handled
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
56
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
57 ;;; Code:
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
58
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
59 (eval-when-compile (require 'cl))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
60
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
61 (require 'gnus)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
62 (require 'gnus-int)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
63 (require 'gnus-sum)
73269
aeb79612dc36 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
64 (require 'gnus-util)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
65 (require 'nnmail)
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
66 (require 'easymenu)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
67
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
68 (defvar gnus-adaptive-word-syntax-table)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85712
diff changeset
69
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
70 (defvar gnus-registry-dirty t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
71 "Boolean set to t when the registry is modified")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
72
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
73 (defgroup gnus-registry nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
74 "The Gnus registry."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
75 :version "22.1"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
76 :group 'gnus)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
77
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
78 (defvar gnus-registry-hashtb (make-hash-table
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
79 :size 256
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
80 :test 'equal)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
81 "*The article registry by Message ID.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
82
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
83 (defcustom gnus-registry-marks
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
84 '((Important
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
85 :char ?i
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
86 :image "summary_important")
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
87 (Work
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
88 :char ?w
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
89 :image "summary_work")
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
90 (Personal
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
91 :char ?p
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
92 :image "summary_personal")
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
93 (To-Do
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
94 :char ?t
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
95 :image "summary_todo")
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
96 (Later
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
97 :char ?l
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
98 :image "summary_later"))
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
99
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
100 "List of registry marks and their options.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
101
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
102 `gnus-registry-mark-article' will offer symbols from this list
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
103 for completion.
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
104
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
105 Each entry must have a character to be useful for summary mode
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
106 line display and for keyboard shortcuts.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
107
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
108 Each entry must have an image string to be useful for visual
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
109 display."
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
110 :group 'gnus-registry
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
111 :type '(repeat :tag "Registry Marks"
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
112 (cons :tag "Mark"
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
113 (symbol :tag "Name")
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
114 (checklist :tag "Options" :greedy t
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
115 (group :inline t
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
116 (const :format "" :value :char)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
117 (character :tag "Character code"))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
118 (group :inline t
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
119 (const :format "" :value :image)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
120 (string :tag "Image"))))))
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
121
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
122 (defcustom gnus-registry-default-mark 'To-Do
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
123 "The default mark. Should be a valid key for `gnus-registry-marks'."
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
124 :group 'gnus-registry
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
125 :type 'symbol)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
126
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
127 (defcustom gnus-registry-unfollowed-groups
110666
3b9bd3888ee9 nnimap.el (nnimap-request-accept-article): Get the Message-ID without the \r.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
128 '("delayed$" "drafts$" "queue$" "INBOX$" "^nnmairix:")
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
129 "List of groups that gnus-registry-split-fancy-with-parent won't return.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
130 The group names are matched, they don't have to be fully
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
131 qualified. This parameter tells the Registry 'never split a
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
132 message into a group that matches one of these, regardless of
110666
3b9bd3888ee9 nnimap.el (nnimap-request-accept-article): Get the Message-ID without the \r.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
133 references.'
3b9bd3888ee9 nnimap.el (nnimap-request-accept-article): Get the Message-ID without the \r.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
134
3b9bd3888ee9 nnimap.el (nnimap-request-accept-article): Get the Message-ID without the \r.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
135 nnmairix groups are specifically excluded because they are ephemeral."
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
136 :group 'gnus-registry
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
137 :type '(repeat regexp))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
138
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
139 (defcustom gnus-registry-install 'ask
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
140 "Whether the registry should be installed."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
141 :group 'gnus-registry
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
142 :type '(choice (const :tag "Never Install" nil)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
143 (const :tag "Always Install" t)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
144 (const :tag "Ask Me" ask)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
145
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
146 (defvar gnus-summary-misc-menu) ;; Avoid byte compiler warning.
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
147
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
148 (defvar gnus-registry-misc-menus nil) ; ugly way to keep the menus
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
149
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
150 (defcustom gnus-registry-clean-empty t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
151 "Whether the empty registry entries should be deleted.
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
152 Registry entries are considered empty when they have no groups
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
153 and no extra data."
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
154 :group 'gnus-registry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
155 :type 'boolean)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
156
98286
30636ed66b80 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97898
diff changeset
157 (defcustom gnus-registry-use-long-group-names t
30636ed66b80 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97898
diff changeset
158 "Whether the registry should use long group names."
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
159 :group 'gnus-registry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
160 :type 'boolean)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
161
97898
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
162 (defcustom gnus-registry-max-track-groups 20
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
163 "The maximum number of non-unique group matches to check for a message ID."
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
164 :group 'gnus-registry
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
165 :type '(radio (const :format "Unlimited " nil)
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
166 (integer :format "Maximum non-unique matches: %v")))
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
167
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
168 (defcustom gnus-registry-track-extra nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
169 "Whether the registry should track extra data about a message.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
170 The Subject and Sender (From:) headers are currently tracked this
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
171 way."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
172 :group 'gnus-registry
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
173 :type
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
174 '(set :tag "Tracking choices"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
175 (const :tag "Track by subject (Subject: header)" subject)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
176 (const :tag "Track by sender (From: header)" sender)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
177
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
178 (defcustom gnus-registry-split-strategy nil
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
179 "Whether the registry should track extra data about a message.
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
180 The Subject and Sender (From:) headers are currently tracked this
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
181 way."
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
182 :group 'gnus-registry
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
183 :type
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
184 '(choice :tag "Tracking choices"
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
185 (const :tag "Only use single choices, discard multiple matches" nil)
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
186 (const :tag "Majority of matches wins" majority)
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
187 (const :tag "First found wins" first)))
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
188
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
189 (defcustom gnus-registry-entry-caching t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
190 "Whether the registry should cache extra information."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
191 :group 'gnus-registry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
192 :type 'boolean)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
193
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
194 (defcustom gnus-registry-minimum-subject-length 5
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
195 "The minimum length of a subject before it's considered trackable."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
196 :group 'gnus-registry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
197 :type 'integer)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
198
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
199 (defcustom gnus-registry-trim-articles-without-groups t
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
200 "Whether the registry should clean out message IDs without groups."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
201 :group 'gnus-registry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
202 :type 'boolean)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
203
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
204 (defcustom gnus-registry-extra-entries-precious '(marks)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
205 "What extra entries are precious, meaning they won't get trimmed.
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
206 When you save the Gnus registry, it's trimmed to be no longer
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
207 than `gnus-registry-max-entries' (which is nil by default, so no
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
208 trimming happens). Any entries with extra data in this list (by
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
209 default, marks are included, so articles with marks are
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
210 considered precious) will not be trimmed."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
211 :group 'gnus-registry
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
212 :type '(repeat symbol))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
213
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
214 (defcustom gnus-registry-cache-file
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
215 (nnheader-concat
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
216 (or gnus-dribble-directory gnus-home-directory "~/")
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
217 ".gnus.registry.eld")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
218 "File where the Gnus registry will be stored."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
219 :group 'gnus-registry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
220 :type 'file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
221
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
222 (defcustom gnus-registry-max-entries nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
223 "Maximum number of entries in the registry, nil for unlimited."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
224 :group 'gnus-registry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
225 :type '(radio (const :format "Unlimited " nil)
58835
9bdd97960431 Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Miles Bader <miles@gnu.org>
parents: 57856
diff changeset
226 (integer :format "Maximum number: %v")))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
227
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
228 (defun gnus-registry-track-subject-p ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
229 (memq 'subject gnus-registry-track-extra))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
230
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
231 (defun gnus-registry-track-sender-p ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
232 (memq 'sender gnus-registry-track-extra))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
233
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
234 (defun gnus-registry-cache-read ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
235 "Read the registry cache file."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
236 (interactive)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
237 (let ((file gnus-registry-cache-file))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
238 (when (file-exists-p file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
239 (gnus-message 5 "Reading %s..." file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
240 (gnus-load file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
241 (gnus-message 5 "Reading %s...done" file))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
242
76836
9feeb7a817c0 * nnmail.el (nnmail-spool-file): Mark as obsolete.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 75347
diff changeset
243 ;; FIXME: Get rid of duplicated code, cf. `gnus-save-newsrc-file' in
9feeb7a817c0 * nnmail.el (nnmail-spool-file): Mark as obsolete.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 75347
diff changeset
244 ;; `gnus-start.el'. --rsteib
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
245 (defun gnus-registry-cache-save ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
246 "Save the registry cache file."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
247 (interactive)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
248 (let ((file gnus-registry-cache-file))
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110358
diff changeset
249 (with-current-buffer (gnus-get-buffer-create " *Gnus-registry-cache*")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
250 (make-local-variable 'version-control)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
251 (setq version-control gnus-backup-startup-file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
252 (setq buffer-file-name file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
253 (setq default-directory (file-name-directory buffer-file-name))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
254 (buffer-disable-undo)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
255 (erase-buffer)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
256 (gnus-message 5 "Saving %s..." file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
257 (if gnus-save-startup-file-via-temp-buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
258 (let ((coding-system-for-write gnus-ding-file-coding-system)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
259 (standard-output (current-buffer)))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
260 (gnus-gnus-to-quick-newsrc-format
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
261 t "gnus registry startup file" 'gnus-registry-alist)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
262 (gnus-registry-cache-whitespace file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
263 (save-buffer))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
264 (let ((coding-system-for-write gnus-ding-file-coding-system)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
265 (version-control gnus-backup-startup-file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
266 (startup-file file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
267 (working-dir (file-name-directory file))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
268 working-file
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
269 (i -1))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
270 ;; Generate the name of a non-existent file.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
271 (while (progn (setq working-file
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
272 (format
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
273 (if (and (eq system-type 'ms-dos)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
274 (not (gnus-long-file-names)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
275 "%s#%d.tm#" ; MSDOS limits files to 8+3
97142
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94748
diff changeset
276 "%s#tmp#%d")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
277 working-dir (setq i (1+ i))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
278 (file-exists-p working-file)))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
279
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
280 (unwind-protect
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
281 (progn
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
282 (gnus-with-output-to-file working-file
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
283 (gnus-gnus-to-quick-newsrc-format
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
284 t "gnus registry startup file" 'gnus-registry-alist))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
285
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
286 ;; These bindings will mislead the current buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
287 ;; into thinking that it is visiting the startup
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
288 ;; file.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
289 (let ((buffer-backed-up nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
290 (buffer-file-name startup-file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
291 (file-precious-flag t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
292 (setmodes (file-modes startup-file)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
293 ;; Backup the current version of the startup file.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
294 (backup-buffer)
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
295
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
296 ;; Replace the existing startup file with the temp file.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
297 (rename-file working-file startup-file t)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
298 (gnus-set-file-modes startup-file setmodes)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
299 (condition-case nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
300 (delete-file working-file)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
301 (file-error nil)))))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
302
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
303 (gnus-kill-buffer (current-buffer))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
304 (gnus-message 5 "Saving %s...done" file))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
305
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
306 ;; Idea from Dan Christensen <jdc@chow.mat.jhu.edu>
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
307 ;; Save the gnus-registry file with extra line breaks.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
308 (defun gnus-registry-cache-whitespace (filename)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
309 (gnus-message 7 "Adding whitespace to %s" filename)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
310 (save-excursion
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
311 (goto-char (point-min))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
312 (while (re-search-forward "^(\\|(\\\"" nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
313 (replace-match "\n\\&" t))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
314 (goto-char (point-min))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
315 (while (re-search-forward " $" nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
316 (replace-match "" t t))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
317
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
318 (defun gnus-registry-save (&optional force)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
319 (when (or gnus-registry-dirty force)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
320 (let ((caching gnus-registry-entry-caching))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
321 ;; turn off entry caching, so mtime doesn't get recorded
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
322 (setq gnus-registry-entry-caching nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
323 ;; remove entry caches
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
324 (maphash
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
325 (lambda (key value)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
326 (if (hash-table-p value)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
327 (remhash key gnus-registry-hashtb)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
328 gnus-registry-hashtb)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
329 ;; remove empty entries
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
330 (when gnus-registry-clean-empty
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
331 (gnus-registry-clean-empty-function))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
332 ;; now trim and clean text properties from the registry appropriately
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
333 (setq gnus-registry-alist
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
334 (gnus-registry-remove-alist-text-properties
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
335 (gnus-registry-trim
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
336 (gnus-hashtable-to-alist
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
337 gnus-registry-hashtb))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
338 ;; really save
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
339 (gnus-registry-cache-save)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
340 (setq gnus-registry-entry-caching caching)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
341 (setq gnus-registry-dirty nil))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
342
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
343 (defun gnus-registry-clean-empty-function ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
344 "Remove all empty entries from the registry. Returns count thereof."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
345 (let ((count 0))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
346
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
347 (maphash
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
348 (lambda (key value)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
349 (when (stringp key)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
350 (dolist (group (gnus-registry-fetch-groups key))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
351 (when (gnus-parameter-registry-ignore group)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
352 (gnus-message
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
353 10
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
354 "gnus-registry: deleted ignored group %s from key %s"
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
355 group key)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
356 (gnus-registry-delete-group key group)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
357
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
358 (unless (gnus-registry-group-count key)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
359 (gnus-registry-delete-id key))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
360
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
361 (unless (or
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
362 (gnus-registry-fetch-group key)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
363 ;; TODO: look for specific extra data here!
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
364 ;; in this example, we look for 'label
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
365 (gnus-registry-fetch-extra key 'label))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
366 (incf count)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
367 (gnus-registry-delete-id key))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
368
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
369 (unless (stringp key)
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
370 (gnus-message
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
371 10
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
372 "gnus-registry key %s was not a string, removing"
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
373 key)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
374 (gnus-registry-delete-id key))))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
375
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
376 gnus-registry-hashtb)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
377 count))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
378
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
379 (defun gnus-registry-read ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
380 (gnus-registry-cache-read)
73269
aeb79612dc36 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
381 (setq gnus-registry-hashtb (gnus-alist-to-hashtable gnus-registry-alist))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
382 (setq gnus-registry-dirty nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
383
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
384 (defun gnus-registry-remove-alist-text-properties (v)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
385 "Remove text properties from all strings in alist."
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
386 (if (stringp v)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
387 (gnus-string-remove-all-properties v)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
388 (if (and (listp v) (listp (cdr v)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
389 (mapcar 'gnus-registry-remove-alist-text-properties v)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
390 (if (and (listp v) (stringp (cdr v)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
391 (cons (gnus-registry-remove-alist-text-properties (car v))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
392 (gnus-registry-remove-alist-text-properties (cdr v)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
393 v))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
394
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
395 (defun gnus-registry-trim (alist)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
396 "Trim alist to size, using gnus-registry-max-entries.
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
397 Any entries with extra data (marks, currently) are left alone."
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
398 (if (null gnus-registry-max-entries)
57055
06f2ccbf6e0f Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-539
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
399 alist ; just return the alist
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
400 ;; else, when given max-entries, trim the alist
57055
06f2ccbf6e0f Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-539
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
401 (let* ((timehash (make-hash-table
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
402 :size 20000
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
403 :test 'equal))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
404 (precious (make-hash-table
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
405 :size 20000
57055
06f2ccbf6e0f Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-539
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
406 :test 'equal))
06f2ccbf6e0f Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-539
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
407 (trim-length (- (length alist) gnus-registry-max-entries))
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
408 (trim-length (if (natnump trim-length) trim-length 0))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
409 precious-list junk-list)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
410 (maphash
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
411 (lambda (key value)
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
412 (let ((extra (gnus-registry-fetch-extra key)))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
413 (dolist (item gnus-registry-extra-entries-precious)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
414 (dolist (e extra)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
415 (when (equal (nth 0 e) item)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
416 (puthash key t precious)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
417 (return))))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
418 (puthash key (gnus-registry-fetch-extra key 'mtime) timehash)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
419 gnus-registry-hashtb)
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
420
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
421 (dolist (item alist)
92255
5602f2f74fe4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87859
diff changeset
422 (let ((key (nth 0 item)))
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
423 (if (gethash key precious)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
424 (push item precious-list)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
425 (push item junk-list))))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
426
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
427 (sort
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
428 junk-list
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
429 (lambda (a b)
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
430 (let ((t1 (or (cdr (gethash (car a) timehash))
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
431 '(0 0 0)))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
432 (t2 (or (cdr (gethash (car b) timehash))
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
433 '(0 0 0))))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
434 (time-less-p t1 t2))))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
435
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
436 ;; we use the return value of this setq, which is the trimmed alist
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
437 (setq alist (append precious-list
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
438 (nthcdr trim-length junk-list))))))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
439
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
440 (defun gnus-registry-action (action data-header from &optional to method)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
441 (let* ((id (mail-header-id data-header))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
442 (subject (gnus-string-remove-all-properties
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
443 (gnus-registry-simplify-subject
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
444 (mail-header-subject data-header))))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
445 (sender (gnus-string-remove-all-properties
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
446 (mail-header-from data-header)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
447 (from (gnus-group-guess-full-name-from-command-method from))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
448 (to (if to (gnus-group-guess-full-name-from-command-method to) nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
449 (to-name (if to to "the Bit Bucket"))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
450 (old-entry (gethash id gnus-registry-hashtb)))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
451 (gnus-message 7 "Registry: article %s %s from %s to %s"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
452 id
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
453 (if method "respooling" "going")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
454 from
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
455 to)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
456
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
457 ;; All except copy will need a delete
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
458 (gnus-registry-delete-group id from)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
459
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
460 (when (equal 'copy action)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
461 (gnus-registry-add-group id from subject sender)) ; undo the delete
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
462
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
463 (gnus-registry-add-group id to subject sender)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
464
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
465 (defun gnus-registry-spool-action (id group &optional subject sender)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
466 (let ((group (gnus-group-guess-full-name-from-command-method group)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
467 (when (and (stringp id) (string-match "\r$" id))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
468 (setq id (substring id 0 -1)))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
469 (gnus-message 7 "Registry: article %s spooled to %s"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
470 id
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
471 group)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
472 (gnus-registry-add-group id group subject sender)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
473
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
474 ;; Function for nn{mail|imap}-split-fancy: look up all references in
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
475 ;; the cache and if a match is found, return that group.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
476 (defun gnus-registry-split-fancy-with-parent ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
477 "Split this message into the same group as its parent. The parent
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
478 is obtained from the registry. This function can be used as an entry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
479 in `nnmail-split-fancy' or `nnimap-split-fancy', for example like
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
480 this: (: gnus-registry-split-fancy-with-parent)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
481
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
482 This function tracks ALL backends, unlike
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
483 `nnmail-split-fancy-with-parent' which tracks only nnmail
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
484 messages.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
485
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
486 For a message to be split, it looks for the parent message in the
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
487 References or In-Reply-To header and then looks in the registry
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
488 to see which group that message was put in. This group is
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
489 returned, unless `gnus-registry-follow-group-p' return nil for
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
490 that group.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
491
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
492 See the Info node `(gnus)Fancy Mail Splitting' for more details."
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
493 (let* ((refstr (or (message-fetch-field "references") "")) ; guaranteed
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
494 (reply-to (message-fetch-field "in-reply-to")) ; may be nil
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
495 ;; now, if reply-to is valid, append it to the References
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
496 (refstr (if reply-to
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
497 (concat refstr " " reply-to)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
498 refstr))
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
499 ;; these may not be used, but the code is cleaner having them up here
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
500 (sender (gnus-string-remove-all-properties
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
501 (message-fetch-field "from")))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
502 (subject (gnus-string-remove-all-properties
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
503 (gnus-registry-simplify-subject
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
504 (message-fetch-field "subject"))))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
505
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
506 (nnmail-split-fancy-with-parent-ignore-groups
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
507 (if (listp nnmail-split-fancy-with-parent-ignore-groups)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
508 nnmail-split-fancy-with-parent-ignore-groups
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
509 (list nnmail-split-fancy-with-parent-ignore-groups)))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
510 (log-agent "gnus-registry-split-fancy-with-parent")
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
511 found found-full)
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
512
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
513 ;; this is a big if-else statement. it uses
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
514 ;; gnus-registry-post-process-groups to filter the results after
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
515 ;; every step.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
516 (cond
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
517 ;; the references string must be valid and parse to valid references
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
518 ((and refstr (gnus-extract-references refstr))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
519 (dolist (reference (nreverse (gnus-extract-references refstr)))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
520 (gnus-message
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
521 9
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
522 "%s is looking for matches for reference %s from [%s]"
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
523 log-agent reference refstr)
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
524 (dolist (group (gnus-registry-fetch-groups
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
525 reference
97898
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
526 gnus-registry-max-track-groups))
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
527 (when (and group (gnus-registry-follow-group-p group))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
528 (gnus-message
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
529 7
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
530 "%s traced the reference %s from [%s] to group %s"
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
531 log-agent reference refstr group)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
532 (push group found))))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
533 ;; filter the found groups and return them
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
534 ;; the found groups are the full groups
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
535 (setq found (gnus-registry-post-process-groups
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
536 "references" refstr found found)))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
537
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
538 ;; else: there were no matches, now try the extra tracking by sender
94451
760ef541936c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94369
diff changeset
539 ((and (gnus-registry-track-sender-p)
760ef541936c Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94369
diff changeset
540 sender
94748
e6e8d9b7ab7d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
541 (not (equal (gnus-extract-address-component-email sender)
e6e8d9b7ab7d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
542 user-mail-address)))
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
543 (maphash
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
544 (lambda (key value)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
545 (let ((this-sender (cdr
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
546 (gnus-registry-fetch-extra key 'sender)))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
547 matches)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
548 (when (and this-sender
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
549 (equal sender this-sender))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
550 (let ((groups (gnus-registry-fetch-groups
97898
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
551 key
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
552 gnus-registry-max-track-groups)))
93386
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
553 (dolist (group groups)
111029
fc6dc700cc9f Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
554 (when (and group (gnus-registry-follow-group-p group))
fc6dc700cc9f Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
555 (push group found-full)
fc6dc700cc9f Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
556 (setq found (append (list group) (delete group found))))))
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
557 (push key matches)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
558 (gnus-message
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
559 ;; raise level of messaging if gnus-registry-track-extra
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
560 (if gnus-registry-track-extra 7 9)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
561 "%s (extra tracking) traced sender %s to groups %s (keys %s)"
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
562 log-agent sender found matches))))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
563 gnus-registry-hashtb)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
564 ;; filter the found groups and return them
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
565 ;; the found groups are NOT the full groups
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
566 (setq found (gnus-registry-post-process-groups
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
567 "sender" sender found found-full)))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
568
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
569 ;; else: there were no matches, now try the extra tracking by subject
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
570 ((and (gnus-registry-track-subject-p)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
571 subject
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
572 (< gnus-registry-minimum-subject-length (length subject)))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
573 (maphash
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
574 (lambda (key value)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
575 (let ((this-subject (cdr
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
576 (gnus-registry-fetch-extra key 'subject)))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
577 matches)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
578 (when (and this-subject
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
579 (equal subject this-subject))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
580 (let ((groups (gnus-registry-fetch-groups
97898
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
581 key
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
582 gnus-registry-max-track-groups)))
93386
a789a1138b08 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92694
diff changeset
583 (dolist (group groups)
111029
fc6dc700cc9f Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
584 (when (and group (gnus-registry-follow-group-p group))
fc6dc700cc9f Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
585 (push group found-full)
fc6dc700cc9f Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
586 (setq found (append (list group) (delete group found))))))
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
587 (push key matches)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
588 (gnus-message
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
589 ;; raise level of messaging if gnus-registry-track-extra
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
590 (if gnus-registry-track-extra 7 9)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
591 "%s (extra tracking) traced subject %s to groups %s (keys %s)"
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
592 log-agent subject found matches))))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
593 gnus-registry-hashtb)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
594 ;; filter the found groups and return them
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
595 ;; the found groups are NOT the full groups
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
596 (setq found (gnus-registry-post-process-groups
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
597 "subject" subject found found-full))))
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
598 ;; after the (cond) we extract the actual value safely
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
599 (car-safe found)))
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
600
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
601 (defun gnus-registry-post-process-groups (mode key groups groups-full)
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
602 "Modifies GROUPS found by MODE for KEY to determine which ones to follow.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
603
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
604 MODE can be 'subject' or 'sender' for example. The KEY is the
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
605 value by which MODE was searched.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
606
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
607 Transforms each group name to the equivalent short name.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
608
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
609 Checks if the current Gnus method (from `gnus-command-method' or
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
610 from `gnus-newsgroup-name') is the same as the group's method.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
611 This is not possible if gnus-registry-use-long-group-names is
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
612 false. Foreign methods are not supported so they are rejected.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
613
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
614 Reduces the list to a single group, or complains if that's not
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
615 possible. Uses `gnus-registry-split-strategy' and GROUPS-FULL if
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
616 necessary."
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
617 (let ((log-agent "gnus-registry-post-process-group")
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
618 out)
94369
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
619
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
620 ;; the strategy can be 'first, 'majority, or nil
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
621 (when (eq gnus-registry-split-strategy 'first)
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
622 (when groups
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
623 (setq groups (list (car-safe groups)))))
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
624
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
625 (when (eq gnus-registry-split-strategy 'majority)
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
626 (let ((freq (make-hash-table
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
627 :size 256
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
628 :test 'equal)))
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
629 (mapc (lambda(x) (puthash x (1+ (gethash x freq 0)) freq)) groups-full)
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
630 (setq groups (list (car-safe
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
631 (sort
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
632 groups
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
633 (lambda (a b)
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
634 (> (gethash a freq 0)
86c0a3e7c039 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94209
diff changeset
635 (gethash b freq 0)))))))))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
636
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
637 (if gnus-registry-use-long-group-names
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
638 (dolist (group groups)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
639 (let ((m1 (gnus-find-method-for-group group))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
640 (m2 (or gnus-command-method
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
641 (gnus-find-method-for-group gnus-newsgroup-name)))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
642 (short-name (gnus-group-short-name group)))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
643 (if (gnus-methods-equal-p m1 m2)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
644 (progn
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
645 ;; this is REALLY just for debugging
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
646 (gnus-message
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
647 10
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
648 "%s stripped group %s to %s"
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
649 log-agent group short-name)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
650 (unless (member short-name out)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
651 (push short-name out)))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
652 ;; else...
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
653 (gnus-message
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
654 7
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
655 "%s ignored foreign group %s"
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
656 log-agent group))))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
657 (setq out groups))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
658 (when (cdr-safe out)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
659 (gnus-message
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
660 5
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
661 "%s: too many extra matches (%s) for %s %s. Returning none."
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
662 log-agent out mode key)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
663 (setq out nil))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
664 out))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
665
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
666 (defun gnus-registry-follow-group-p (group)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
667 "Determines if a group name should be followed.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
668 Consults `gnus-registry-unfollowed-groups' and
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
669 `nnmail-split-fancy-with-parent-ignore-groups'."
109764
f5fa348fd8eb Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107473
diff changeset
670 (not (or (gnus-grep-in-list
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
671 group
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
672 gnus-registry-unfollowed-groups)
109764
f5fa348fd8eb Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 107473
diff changeset
673 (gnus-grep-in-list
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
674 group
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
675 nnmail-split-fancy-with-parent-ignore-groups))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
676
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
677 (defun gnus-registry-wash-for-keywords (&optional force)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
678 (interactive)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
679 (let ((id (gnus-registry-fetch-message-id-fast gnus-current-article))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
680 word words)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
681 (if (or (not (gnus-registry-fetch-extra id 'keywords))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
682 force)
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110358
diff changeset
683 (with-current-buffer gnus-article-buffer
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
684 (article-goto-body)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
685 (save-window-excursion
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
686 (save-restriction
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
687 (narrow-to-region (point) (point-max))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
688 (with-syntax-table gnus-adaptive-word-syntax-table
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
689 (while (re-search-forward "\\b\\w+\\b" nil t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
690 (setq word (gnus-registry-remove-alist-text-properties
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
691 (downcase (buffer-substring
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
692 (match-beginning 0) (match-end 0)))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
693 (if (> (length word) 3)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
694 (push word words))))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
695 (gnus-registry-store-extra-entry id 'keywords words)))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
696
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
697 (defun gnus-registry-find-keywords (keyword)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
698 (interactive "skeyword: ")
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
699 (let (articles)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
700 (maphash
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
701 (lambda (key value)
94748
e6e8d9b7ab7d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
702 (when (member keyword
e6e8d9b7ab7d Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 94662
diff changeset
703 (cdr-safe (gnus-registry-fetch-extra key 'keywords)))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
704 (push key articles)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
705 gnus-registry-hashtb)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
706 articles))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
707
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
708 (defun gnus-registry-register-message-ids ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
709 "Register the Message-ID of every article in the group"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
710 (unless (gnus-parameter-registry-ignore gnus-newsgroup-name)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
711 (dolist (article gnus-newsgroup-articles)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
712 (let ((id (gnus-registry-fetch-message-id-fast article)))
92255
5602f2f74fe4 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87859
diff changeset
713 (unless (member gnus-newsgroup-name (gnus-registry-fetch-groups id))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
714 (gnus-message 9 "Registry: Registering article %d with group %s"
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
715 article gnus-newsgroup-name)
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
716 (gnus-registry-add-group
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
717 id
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
718 gnus-newsgroup-name
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
719 (gnus-registry-fetch-simplified-message-subject-fast article)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
720 (gnus-registry-fetch-sender-fast article)))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
721
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
722 (defun gnus-registry-fetch-message-id-fast (article)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
723 "Fetch the Message-ID quickly, using the internal gnus-data-list function"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
724 (if (and (numberp article)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
725 (assoc article (gnus-data-list nil)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
726 (mail-header-id (gnus-data-header (assoc article (gnus-data-list nil))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
727 nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
728
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
729 (defun gnus-registry-simplify-subject (subject)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
730 (if (stringp subject)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
731 (gnus-simplify-subject subject)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
732 nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
733
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
734 (defun gnus-registry-fetch-simplified-message-subject-fast (article)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
735 "Fetch the Subject quickly, using the internal gnus-data-list function"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
736 (if (and (numberp article)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
737 (assoc article (gnus-data-list nil)))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
738 (gnus-string-remove-all-properties
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
739 (gnus-registry-simplify-subject
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
740 (mail-header-subject (gnus-data-header
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
741 (assoc article (gnus-data-list nil))))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
742 nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
743
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
744 (defun gnus-registry-fetch-sender-fast (article)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
745 "Fetch the Sender quickly, using the internal gnus-data-list function"
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
746 (if (and (numberp article)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
747 (assoc article (gnus-data-list nil)))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
748 (gnus-string-remove-all-properties
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
749 (mail-header-from (gnus-data-header
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
750 (assoc article (gnus-data-list nil)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
751 nil))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
752
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
753 (defun gnus-registry-do-marks (type function)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
754 "For each known mark, call FUNCTION for each cell of type TYPE.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
755
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
756 FUNCTION should take two parameters, a mark symbol and the cell value."
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
757 (dolist (mark-info gnus-registry-marks)
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
758 (let* ((mark (car-safe mark-info))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
759 (data (cdr-safe mark-info))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
760 (cell-data (plist-get data type)))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
761 (when cell-data
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
762 (funcall function mark cell-data)))))
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
763
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
764 ;;; this is ugly code, but I don't know how to do it better
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
765 (defun gnus-registry-install-shortcuts ()
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
766 "Install the keyboard shortcuts and menus for the registry.
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
767 Uses `gnus-registry-marks' to find what shortcuts to install."
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
768 (let (keys-plist)
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
769 (setq gnus-registry-misc-menus nil)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
770 (gnus-registry-do-marks
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
771 :char
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
772 (lambda (mark data)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
773 (let ((function-format
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
774 (format "gnus-registry-%%s-article-%s-mark" mark)))
92359
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
775
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
776 ;;; The following generates these functions:
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
777 ;;; (defun gnus-registry-set-article-Important-mark (&rest articles)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
778 ;;; "Apply the Important mark to process-marked ARTICLES."
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
779 ;;; (interactive (gnus-summary-work-articles current-prefix-arg))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
780 ;;; (gnus-registry-set-article-mark-internal 'Important articles nil t))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
781 ;;; (defun gnus-registry-remove-article-Important-mark (&rest articles)
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
782 ;;; "Apply the Important mark to process-marked ARTICLES."
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
783 ;;; (interactive (gnus-summary-work-articles current-prefix-arg))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
784 ;;; (gnus-registry-set-article-mark-internal 'Important articles t t))
1af6d6eab2e9 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92255
diff changeset
785
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
786 (dolist (remove '(t nil))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
787 (let* ((variant-name (if remove "remove" "set"))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
788 (function-name (format function-format variant-name))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
789 (shortcut (format "%c" data))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
790 (shortcut (if remove (upcase shortcut) shortcut)))
110358
79de2afad0d9 Explicitly pass `obarray' to `unintern' to avoid a warning.
Juanma Barranquero <lekktu@gmail.com>
parents: 110111
diff changeset
791 (unintern function-name obarray)
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
792 (eval
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
793 `(defun
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
794 ;; function name
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
795 ,(intern function-name)
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
796 ;; parameter definition
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
797 (&rest articles)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
798 ;; documentation
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
799 ,(format
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
800 "%s the %s mark over process-marked ARTICLES."
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
801 (upcase-initials variant-name)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
802 mark)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
803 ;; interactive definition
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
804 (interactive
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
805 (gnus-summary-work-articles current-prefix-arg))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
806 ;; actual code
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
807
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
808 ;; if this is called and the user doesn't want the
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
809 ;; registry enabled, we'll ask anyhow
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
810 (when (eq gnus-registry-install nil)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
811 (setq gnus-registry-install 'ask))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
812
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
813 ;; now the user is asked if gnus-registry-install is 'ask
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
814 (when (gnus-registry-install-p)
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
815 (gnus-registry-set-article-mark-internal
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
816 ;; all this just to get the mark, I must be doing it wrong
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
817 (intern ,(symbol-name mark))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
818 articles ,remove t)
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
819 (gnus-message
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
820 9
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
821 "Applying mark %s to %d articles"
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
822 ,(symbol-name mark) (length articles))
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
823 (dolist (article articles)
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
824 (gnus-summary-update-article
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
825 article
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
826 (assoc article (gnus-data-list nil)))))))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
827 (push (intern function-name) keys-plist)
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
828 (push shortcut keys-plist)
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
829 (push (vector (format "%s %s"
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
830 (upcase-initials variant-name)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
831 (symbol-name mark))
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
832 (intern function-name) t)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
833 gnus-registry-misc-menus)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
834 (gnus-message
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
835 9
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
836 "Defined mark handling function %s"
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
837 function-name))))))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
838 (gnus-define-keys-1
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
839 '(gnus-registry-mark-map "M" gnus-summary-mark-map)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
840 keys-plist)
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
841 (add-hook 'gnus-summary-menu-hook
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
842 (lambda ()
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
843 (easy-menu-add-item
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
844 gnus-summary-misc-menu
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
845 nil
107473
0fe940324254 Synch with Gnus trunk
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 106815
diff changeset
846 (cons "Registry Marks" gnus-registry-misc-menus))))))
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
847
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
848 ;;; use like this:
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
849 ;;; (defalias 'gnus-user-format-function-M
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
850 ;;; 'gnus-registry-user-format-function-M)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
851 (defun gnus-registry-user-format-function-M (headers)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
852 (let* ((id (mail-header-message-id headers))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
853 (marks (when id (gnus-registry-fetch-extra-marks id))))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
854 (apply 'concat (mapcar (lambda(mark)
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
855 (let ((c
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
856 (plist-get
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
857 (cdr-safe
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
858 (assoc mark gnus-registry-marks))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
859 :char)))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
860 (if c
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
861 (list c)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
862 nil)))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
863 marks))))
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
864
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
865 (defun gnus-registry-read-mark ()
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
866 "Read a mark name from the user with completion."
110661
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
867 (let ((mark (gnus-completing-read
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
868 "Label"
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
869 (mapcar 'symbol-name (mapcar 'car gnus-registry-marks))
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
870 nil nil nil
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
871 (symbol-name gnus-registry-default-mark))))
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
872 (when (stringp mark)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
873 (intern mark))))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
874
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
875 (defun gnus-registry-set-article-mark (&rest articles)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
876 "Apply a mark to process-marked ARTICLES."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
877 (interactive (gnus-summary-work-articles current-prefix-arg))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
878 (gnus-registry-set-article-mark-internal (gnus-registry-read-mark) articles nil t))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
879
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
880 (defun gnus-registry-remove-article-mark (&rest articles)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
881 "Remove a mark from process-marked ARTICLES."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
882 (interactive (gnus-summary-work-articles current-prefix-arg))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
883 (gnus-registry-set-article-mark-internal (gnus-registry-read-mark) articles t t))
87454
0cbc451989a7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 86154
diff changeset
884
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
885 (defun gnus-registry-set-article-mark-internal (mark articles &optional remove show-message)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
886 "Apply a mark to a list of ARTICLES."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
887 (let ((article-id-list
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
888 (mapcar 'gnus-registry-fetch-message-id-fast articles)))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
889 (dolist (id article-id-list)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
890 (let* (
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
891 ;; all the marks for this article without the mark of
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
892 ;; interest
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
893 (marks
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
894 (delq mark (gnus-registry-fetch-extra-marks id)))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
895 ;; the new marks we want to use
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
896 (new-marks (if remove
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
897 marks
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
898 (cons mark marks))))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
899 (when show-message
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
900 (gnus-message 1 "%s mark %s with message ID %s, resulting in %S"
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
901 (if remove "Removing" "Adding")
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
902 mark id new-marks))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
903
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
904 (apply 'gnus-registry-store-extra-marks ; set the extra marks
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
905 id ; for the message ID
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
906 new-marks)))))
87454
0cbc451989a7 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 86154
diff changeset
907
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
908 (defun gnus-registry-get-article-marks (&rest articles)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
909 "Get the Gnus registry marks for ARTICLES and show them if interactive.
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
910 Uses process/prefix conventions. For multiple articles,
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
911 only the last one's marks are returned."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
912 (interactive (gnus-summary-work-articles 1))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
913 (let (marks)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
914 (dolist (article articles)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
915 (let ((article-id
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
916 (gnus-registry-fetch-message-id-fast article)))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
917 (setq marks (gnus-registry-fetch-extra-marks article-id))))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
918 (when (interactive-p)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
919 (gnus-message 1 "Marks are %S" marks))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
920 marks))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
921
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
922 ;;; if this extends to more than 'marks, it should be improved to be more generic.
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
923 (defun gnus-registry-fetch-extra-marks (id)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
924 "Get the marks of a message, based on the message ID.
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
925 Returns a list of symbol marks or nil."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
926 (car-safe (cdr (gnus-registry-fetch-extra id 'marks))))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
927
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
928 (defun gnus-registry-has-extra-mark (id mark)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
929 "Checks if a message has `mark', based on the message ID `id'."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
930 (memq mark (gnus-registry-fetch-extra-marks id)))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
931
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
932 (defun gnus-registry-store-extra-marks (id &rest mark-list)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
933 "Set the marks of a message, based on the message ID.
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
934 The `mark-list' can be nil, in which case no marks are left."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
935 (gnus-registry-store-extra-entry id 'marks (list mark-list)))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
936
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
937 (defun gnus-registry-delete-extra-marks (id &rest mark-delete-list)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
938 "Delete the message marks in `mark-delete-list', based on the message ID."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
939 (let ((marks (gnus-registry-fetch-extra-marks id)))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
940 (when marks
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
941 (dolist (mark mark-delete-list)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
942 (setq marks (delq mark marks))))
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
943 (gnus-registry-store-extra-marks id (car marks))))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
944
87859
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
945 (defun gnus-registry-delete-all-extra-marks (id)
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
946 "Delete all the marks for a message ID."
1bb83c2fe524 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 87649
diff changeset
947 (gnus-registry-store-extra-marks id nil))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
948
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
949 (defun gnus-registry-fetch-extra (id &optional entry)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
950 "Get the extra data of a message, based on the message ID.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
951 Returns the first place where the trail finds a nonstring."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
952 (let ((entry-cache (gethash entry gnus-registry-hashtb)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
953 (if (and entry
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
954 (hash-table-p entry-cache)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
955 (gethash id entry-cache))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
956 (gethash id entry-cache)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
957 ;; else, if there is no caching possible...
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
958 (let ((trail (gethash id gnus-registry-hashtb)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
959 (when (listp trail)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
960 (dolist (crumb trail)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
961 (unless (stringp crumb)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
962 (return (gnus-registry-fetch-extra-entry crumb entry id)))))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
963
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
964 (defun gnus-registry-fetch-extra-entry (alist &optional entry id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
965 "Get the extra data of a message, or a specific entry in it.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
966 Update the entry cache if needed."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
967 (if (and entry id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
968 (let ((entry-cache (gethash entry gnus-registry-hashtb))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
969 entree)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
970 (when gnus-registry-entry-caching
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
971 ;; create the hash table
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
972 (unless (hash-table-p entry-cache)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
973 (setq entry-cache (make-hash-table
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
974 :size 4096
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
975 :test 'equal))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
976 (puthash entry entry-cache gnus-registry-hashtb))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
977
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
978 ;; get the entree from the hash table or from the alist
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
979 (setq entree (gethash id entry-cache)))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
980
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
981 (unless entree
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
982 (setq entree (assq entry alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
983 (when gnus-registry-entry-caching
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
984 (puthash id entree entry-cache)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
985 entree)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
986 alist))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
987
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
988 (defun gnus-registry-store-extra (id extra)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
989 "Store the extra data of a message, based on the message ID.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
990 The message must have at least one group name."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
991 (when (gnus-registry-group-count id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
992 ;; we now know the trail has at least 1 group name, so it's not empty
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
993 (let ((trail (gethash id gnus-registry-hashtb))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
994 (old-extra (gnus-registry-fetch-extra id))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
995 entry-cache)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
996 (dolist (crumb trail)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
997 (unless (stringp crumb)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
998 (dolist (entry crumb)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
999 (setq entry-cache (gethash (car entry) gnus-registry-hashtb))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1000 (when entry-cache
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1001 (remhash id entry-cache))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1002 (puthash id (cons extra (delete old-extra trail))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1003 gnus-registry-hashtb)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1004 (setq gnus-registry-dirty t)))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1005
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1006 (defun gnus-registry-delete-extra-entry (id key)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1007 "Delete a specific entry in the extras field of the registry entry for id."
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1008 (gnus-registry-store-extra-entry id key nil))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1009
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1010 (defun gnus-registry-store-extra-entry (id key value)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1011 "Put a specific entry in the extras field of the registry entry for id."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1012 (let* ((extra (gnus-registry-fetch-extra id))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1013 ;; all the entries except the one for `key'
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
1014 (the-rest (gnus-assq-delete-all key (gnus-registry-fetch-extra id)))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1015 (alist (if value
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1016 (gnus-registry-remove-alist-text-properties
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1017 (cons (cons key value)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1018 the-rest))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1019 the-rest)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1020 (gnus-registry-store-extra id alist)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1021
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1022 (defun gnus-registry-fetch-group (id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1023 "Get the group of a message, based on the message ID.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1024 Returns the first place where the trail finds a group name."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1025 (when (gnus-registry-group-count id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1026 ;; we now know the trail has at least 1 group name
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1027 (let ((trail (gethash id gnus-registry-hashtb)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1028 (dolist (crumb trail)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1029 (when (stringp crumb)
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1030 (return (if gnus-registry-use-long-group-names
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1031 crumb
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1032 (gnus-group-short-name crumb))))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1033
97898
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
1034 (defun gnus-registry-fetch-groups (id &optional max)
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
1035 "Get the groups (up to MAX, if given) of a message, based on the message ID."
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1036 (let ((trail (gethash id gnus-registry-hashtb))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1037 groups)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1038 (dolist (crumb trail)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1039 (when (stringp crumb)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1040 ;; push the group name into the list
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
1041 (setq
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1042 groups
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1043 (cons
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1044 (if (or (not (stringp crumb)) gnus-registry-use-long-group-names)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1045 crumb
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1046 (gnus-group-short-name crumb))
97898
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
1047 groups))
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
1048 (when (and max (> (length groups) max))
5b7eb18818c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 97142
diff changeset
1049 (return))))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1050 ;; return the list of groups
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1051 groups))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1052
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1053 (defun gnus-registry-group-count (id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1054 "Get the number of groups of a message, based on the message ID."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1055 (let ((trail (gethash id gnus-registry-hashtb)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1056 (if (and trail (listp trail))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1057 (apply '+ (mapcar (lambda (x) (if (stringp x) 1 0)) trail))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1058 0)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1059
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1060 (defun gnus-registry-delete-group (id group)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1061 "Delete a group for a message, based on the message ID."
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1062 (when (and group id)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1063 (let ((trail (gethash id gnus-registry-hashtb))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1064 (short-group (gnus-group-short-name group)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1065 (puthash id (if trail
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1066 (delete short-group (delete group trail))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1067 nil)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1068 gnus-registry-hashtb))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1069 ;; now, clear the entry if there are no more groups
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1070 (when gnus-registry-trim-articles-without-groups
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1071 (unless (gnus-registry-group-count id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1072 (gnus-registry-delete-id id)))
60161
b070535d2416 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
1073 ;; is this ID still in the registry?
b070535d2416 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111
Miles Bader <miles@gnu.org>
parents: 59996
diff changeset
1074 (when (gethash id gnus-registry-hashtb)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
1075 (gnus-registry-store-extra-entry id 'mtime (current-time)))))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1076
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1077 (defun gnus-registry-delete-id (id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1078 "Delete a message ID from the registry."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1079 (when (stringp id)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1080 (remhash id gnus-registry-hashtb)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1081 (maphash
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1082 (lambda (key value)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1083 (when (hash-table-p value)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1084 (remhash id value)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1085 gnus-registry-hashtb)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1086
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1087 (defun gnus-registry-add-group (id group &optional subject sender)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1088 "Add a group for a message, based on the message ID."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1089 (when group
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1090 (when (and id
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1091 (not (string-match "totally-fudged-out-message-id" id)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1092 (let ((full-group group)
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1093 (group (if gnus-registry-use-long-group-names
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1094 group
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1095 (gnus-group-short-name group))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1096 (gnus-registry-delete-group id group)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1097
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1098 (unless gnus-registry-use-long-group-names ;; unnecessary in this case
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1099 (gnus-registry-delete-group id full-group))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1100
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1101 (let ((trail (gethash id gnus-registry-hashtb)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1102 (puthash id (if trail
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1103 (cons group trail)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1104 (list group))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1105 gnus-registry-hashtb)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1106
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1107 (when (and (gnus-registry-track-subject-p)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1108 subject)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1109 (gnus-registry-store-extra-entry
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1110 id
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1111 'subject
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1112 (gnus-registry-simplify-subject subject)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1113 (when (and (gnus-registry-track-sender-p)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1114 sender)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1115 (gnus-registry-store-extra-entry
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1116 id
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1117 'sender
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1118 sender))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1119
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1120 (gnus-registry-store-extra-entry id 'mtime (current-time)))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1121
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1122 (defun gnus-registry-clear ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1123 "Clear the Gnus registry."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1124 (interactive)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1125 (setq gnus-registry-alist nil)
73269
aeb79612dc36 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
1126 (setq gnus-registry-hashtb (gnus-alist-to-hashtable gnus-registry-alist))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1127 (setq gnus-registry-dirty t))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1128
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1129 ;;;###autoload
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1130 (defun gnus-registry-initialize ()
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1131 "Initialize the Gnus registry."
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1132 (interactive)
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1133 (gnus-message 5 "Initializing the registry")
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1134 (setq gnus-registry-install t) ; in case it was 'ask or nil
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1135 (gnus-registry-install-hooks)
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1136 (gnus-registry-install-shortcuts)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1137 (gnus-registry-read))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1138
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1139 ;;;###autoload
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1140 (defun gnus-registry-install-hooks ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1141 "Install the registry hooks."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1142 (interactive)
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1143 (add-hook 'gnus-summary-article-move-hook 'gnus-registry-action)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1144 (add-hook 'gnus-summary-article-delete-hook 'gnus-registry-action)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1145 (add-hook 'gnus-summary-article-expire-hook 'gnus-registry-action)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1146 (add-hook 'nnmail-spool-hook 'gnus-registry-spool-action)
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1147
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1148 (add-hook 'gnus-save-newsrc-hook 'gnus-registry-save)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1149 (add-hook 'gnus-read-newsrc-el-hook 'gnus-registry-read)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1150
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1151 (add-hook 'gnus-summary-prepare-hook 'gnus-registry-register-message-ids))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1152
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1153 (defun gnus-registry-unload-hook ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1154 "Uninstall the registry hooks."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1155 (interactive)
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1156 (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1157 (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1158 (remove-hook 'gnus-summary-article-expire-hook 'gnus-registry-action)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1159 (remove-hook 'nnmail-spool-hook 'gnus-registry-spool-action)
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58835
diff changeset
1160
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1161 (remove-hook 'gnus-save-newsrc-hook 'gnus-registry-save)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1162 (remove-hook 'gnus-read-newsrc-el-hook 'gnus-registry-read)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1163
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1164 (remove-hook 'gnus-summary-prepare-hook 'gnus-registry-register-message-ids))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1165
57552
27c5fd98f808 (gnus-registry-unload-hook): Set as a variable with add-hook.
Richard M. Stallman <rms@gnu.org>
parents: 57055
diff changeset
1166 (add-hook 'gnus-registry-unload-hook 'gnus-registry-unload-hook)
27c5fd98f808 (gnus-registry-unload-hook): Set as a variable with add-hook.
Richard M. Stallman <rms@gnu.org>
parents: 57055
diff changeset
1167
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1168 (defun gnus-registry-install-p ()
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1169 (interactive)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1170 (when (eq gnus-registry-install 'ask)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1171 (setq gnus-registry-install
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1172 (gnus-y-or-n-p
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1173 (concat "Enable the Gnus registry? "
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1174 "See the variable `gnus-registry-install' "
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1175 "to get rid of this query permanently. ")))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1176 (when gnus-registry-install
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1177 ;; we just set gnus-registry-install to t, so initialize the registry!
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1178 (gnus-registry-initialize)))
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1179 ;;; we could call it here: (customize-variable 'gnus-registry-install)
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1180 gnus-registry-install)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1181
92694
d3767aa9ae49 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 92359
diff changeset
1182 ;; TODO: a few things
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1183
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1184 (provide 'gnus-registry)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1185
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff changeset
1186 ;;; gnus-registry.el ends here