* gnus-sum.el (gnus-summary-limit-to-bodies): New command and
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 16 Apr 2006 19:53:34 +0000 (19:53 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 16 Apr 2006 19:53:34 +0000 (19:53 +0000)
keystroke.

lisp/ChangeLog
lisp/gnus-sum.el

index a4d99f9..4d227c0 100644 (file)
@@ -1,5 +1,8 @@
 2006-04-16  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-sum.el (gnus-summary-limit-to-bodies): New command and
+       keystroke. 
+
        * gnus-art.el (gnus-treatment-function-alist): Change order of
        newsgroups/generic header folding to avoid double-folding. 
 
index 37e8a34..a360645 100644 (file)
@@ -1845,6 +1845,7 @@ increase the score of each group you read."
 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
   "/" gnus-summary-limit-to-subject
   "n" gnus-summary-limit-to-articles
+  "b" gnus-summary-limit-to-bodies
   "w" gnus-summary-pop-limit
   "s" gnus-summary-limit-to-subject
   "a" gnus-summary-limit-to-author
@@ -8003,6 +8004,38 @@ If ALL is non-nil, limit strictly to unread articles."
           gnus-duplicate-mark gnus-souped-mark)
      'reverse)))
 
+(defun gnus-summary-limit-to-bodies (match &optional reverse)
+  "Limit the summary buffer to articles that have bodies that match MATCH.
+If REVERSE (the prefix), limit to articles that don't match."
+  (interactive "sMatch body (regexp): \nP")
+  (let ((articles nil)
+       (gnus-select-article-hook nil)  ;Disable hook.
+       (gnus-article-prepare-hook nil)
+       (gnus-use-article-prefetch nil)
+       (gnus-keep-backlog nil)
+       (gnus-break-pages nil)
+       (gnus-summary-display-arrow nil)
+       (gnus-updated-mode-lines nil)
+       (gnus-auto-center-summary nil)
+       (gnus-display-mime-function nil))
+    (dolist (data gnus-newsgroup-data)
+      (let (gnus-mark-article-hook)
+       (gnus-summary-select-article t t nil (gnus-data-number data)))
+      (save-excursion
+       (set-buffer gnus-article-buffer)
+       (article-goto-body)
+       (let* ((case-fold-search t)
+              (found (re-search-forward match nil t)))
+         (when (or (and found
+                        (not reverse))
+                   (and (not found)
+                        reverse))
+           (push (gnus-data-number data) articles)))))
+    (if (not articles)
+       (message "No messages matched")
+      (gnus-summary-limit articles)))
+  (gnus-summary-position-point))
+
 (defun gnus-summary-limit-to-replied (&optional unreplied)
   "Limit the summary buffer to replied articles.
 If UNREPLIED (the prefix), limit to unreplied articles."