(gnus-registry-wash-for-keywords) (gnus-registry-find-keywords): new
authorTeodor Zlatanov <tzz@lifelogs.com>
Mon, 16 Oct 2006 21:03:20 +0000 (21:03 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Mon, 16 Oct 2006 21:03:20 +0000 (21:03 +0000)
functions to allow easy searching of articles that are in the registry

lisp/ChangeLog
lisp/gnus-registry.el

index 49a516f..8a8ce42 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-16  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-registry.el (gnus-registry-wash-for-keywords)
+       (gnus-registry-find-keywords): new functions to allow easy searching of
+       articles that are in the registry
+
 2006-10-16  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * spam.el (spam-check-BBDB, spam-enter-ham-BBDB, spam-parse-list): use
index 7addf5c..babba32 100644 (file)
@@ -492,6 +492,40 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
        (setq res nil))))
     res))
 
+(defun gnus-registry-wash-for-keywords (&optional force)
+  (interactive)
+  (let ((id (gnus-registry-fetch-message-id-fast gnus-current-article))
+       words)
+    (if (or (not (gnus-registry-fetch-extra id 'keywords)) 
+           force)
+      (save-excursion
+       (set-buffer gnus-article-buffer)
+       (let (words)
+         (article-goto-body)
+         (save-window-excursion
+           (save-restriction
+             (narrow-to-region (point) (point-max))
+             (with-syntax-table gnus-adaptive-word-syntax-table
+               (while (re-search-forward "\\b\\w+\\b" nil t)
+                 (setq word (gnus-registry-remove-alist-text-properties 
+                             (downcase (buffer-substring
+                                        (match-beginning 0) (match-end 0)))))
+                 (if (> (length word) 3)
+                     (push word words))))))
+         (gnus-registry-store-extra-entry id 'keywords words))))))
+
+(defun gnus-registry-find-keywords (keyword)
+  (interactive "skeyword: ")
+  (let (articles)
+    (maphash
+     (lambda (key value)
+       (when (gnus-registry-grep-in-list
+             keyword
+             (cdr (gnus-registry-fetch-extra key 'keywords)))
+        (push key articles)))
+     gnus-registry-hashtb)
+    articles))
+
 (defun gnus-registry-register-message-ids ()
   "Register the Message-ID of every article in the group"
   (unless (gnus-parameter-registry-ignore gnus-newsgroup-name)