1 ;;; gnus-registry.el --- article registry for Gnus
3 ;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 ;;; Free Software Foundation, Inc.
6 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
7 ;; Keywords: news registry
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; This is the gnus-registry.el package, which works with all
27 ;; backends, not just nnmail (e.g. NNTP). The major issue is that it
28 ;; doesn't go across backends, so for instance if an article is in
29 ;; nnml:sys and you see a reference to it in nnimap splitting, the
30 ;; article will end up in nnimap:sys
32 ;; gnus-registry.el intercepts article respooling, moving, deleting,
33 ;; and copying for all backends. If it doesn't work correctly for
34 ;; you, submit a bug report and I'll be glad to fix it. It needs
35 ;; documentation in the manual (also on my to-do list).
37 ;; Put this in your startup file (~/.gnus.el for instance)
39 ;; (setq gnus-registry-max-entries 2500
40 ;; gnus-registry-use-long-group-names t)
42 ;; (gnus-registry-initialize)
44 ;; Then use this in your fancy-split:
46 ;; (: gnus-registry-split-fancy-with-parent)
50 ;; - get the correct group on spool actions
52 ;; - articles that are spooled to a different backend should be handled
56 (eval-when-compile (require 'cl))
65 (defvar gnus-adaptive-word-syntax-table)
67 (defvar gnus-registry-dirty t
68 "Boolean set to t when the registry is modified")
70 (defgroup gnus-registry nil
75 (defvar gnus-registry-hashtb (make-hash-table
78 "*The article registry by Message ID.")
80 (defcustom gnus-registry-marks
83 :image "summary_important")
86 :image "summary_work")
89 :image "summary_personal")
92 :image "summary_todo")
95 :image "summary_later"))
97 "List of registry marks and their options.
99 `gnus-registry-mark-article' will offer symbols from this list
102 Each entry must have a character to be useful for summary mode
103 line display and for keyboard shortcuts.
105 Each entry must have an image string to be useful for visual
107 :group 'gnus-registry
108 :type '(repeat :tag "Registry Marks"
111 (checklist :tag "Options" :greedy t
113 (const :format "" :value :char)
114 (character :tag "Character code"))
116 (const :format "" :value :image)
117 (string :tag "Image"))))))
119 (defcustom gnus-registry-default-mark 'To-Do
120 "The default mark. Should be a valid key for `gnus-registry-marks'."
121 :group 'gnus-registry
124 (defcustom gnus-registry-unfollowed-groups
125 '("delayed$" "drafts$" "queue$" "INBOX$")
126 "List of groups that gnus-registry-split-fancy-with-parent won't return.
127 The group names are matched, they don't have to be fully
128 qualified. This parameter tells the Registry 'never split a
129 message into a group that matches one of these, regardless of
131 :group 'gnus-registry
132 :type '(repeat regexp))
134 (defcustom gnus-registry-install 'ask
135 "Whether the registry should be installed."
136 :group 'gnus-registry
137 :type '(choice (const :tag "Never Install" nil)
138 (const :tag "Always Install" t)
139 (const :tag "Ask Me" ask)))
141 (defvar gnus-summary-misc-menu) ;; Avoid byte compiler warning.
143 (defvar gnus-registry-misc-menus nil) ; ugly way to keep the menus
145 (defcustom gnus-registry-clean-empty t
146 "Whether the empty registry entries should be deleted.
147 Registry entries are considered empty when they have no groups
149 :group 'gnus-registry
152 (defcustom gnus-registry-use-long-group-names t
153 "Whether the registry should use long group names."
154 :group 'gnus-registry
157 (defcustom gnus-registry-max-track-groups 20
158 "The maximum number of non-unique group matches to check for a message ID."
159 :group 'gnus-registry
160 :type '(radio (const :format "Unlimited " nil)
161 (integer :format "Maximum non-unique matches: %v")))
163 (defcustom gnus-registry-track-extra nil
164 "Whether the registry should track extra data about a message.
165 The Subject and Sender (From:) headers are currently tracked this
167 :group 'gnus-registry
169 '(set :tag "Tracking choices"
170 (const :tag "Track by subject (Subject: header)" subject)
171 (const :tag "Track by sender (From: header)" sender)))
173 (defcustom gnus-registry-split-strategy nil
174 "Whether the registry should track extra data about a message.
175 The Subject and Sender (From:) headers are currently tracked this
177 :group 'gnus-registry
179 '(choice :tag "Tracking choices"
180 (const :tag "Only use single choices, discard multiple matches" nil)
181 (const :tag "Majority of matches wins" majority)
182 (const :tag "First found wins" first)))
184 (defcustom gnus-registry-entry-caching t
185 "Whether the registry should cache extra information."
186 :group 'gnus-registry
189 (defcustom gnus-registry-minimum-subject-length 5
190 "The minimum length of a subject before it's considered trackable."
191 :group 'gnus-registry
194 (defcustom gnus-registry-trim-articles-without-groups t
195 "Whether the registry should clean out message IDs without groups."
196 :group 'gnus-registry
199 (defcustom gnus-registry-extra-entries-precious '(marks)
200 "What extra entries are precious, meaning they won't get trimmed.
201 When you save the Gnus registry, it's trimmed to be no longer
202 than `gnus-registry-max-entries' (which is nil by default, so no
203 trimming happens). Any entries with extra data in this list (by
204 default, marks are included, so articles with marks are
205 considered precious) will not be trimmed."
206 :group 'gnus-registry
207 :type '(repeat symbol))
209 (defcustom gnus-registry-cache-file