From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/11005 Path: main.gmane.org!not-for-mail From: Kai Grossjohann Newsgroups: gmane.emacs.gnus.general Subject: gnus-glimpse.el -- search a newsgroup using glimpse Date: 20 May 1997 19:39:29 +0200 Message-ID: Reply-To: Kai Grossjohann NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 (generated by tm-edit 7.100) Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1035150787 27735 80.91.224.250 (20 Oct 2002 21:53:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 21:53:07 +0000 (UTC) Cc: Michael.Huehne@Germany.EU.net, Ulrich Pfeifer Return-Path: Original-Received: from sandy.calag.com (root@sandy [206.190.83.128]) by altair.xemacs.org (8.8.5/8.8.5) with ESMTP id LAA32116 for ; Tue, 20 May 1997 11:54:58 -0700 Original-Received: from xemacs.org (xemacs.cs.uiuc.edu [128.174.252.16]) by sandy.calag.com (8.8.5/8.8.5) with ESMTP id LAA11082 for ; Tue, 20 May 1997 11:54:31 -0700 Original-Received: from ifi.uio.no (0@ifi.uio.no [129.240.64.2]) by xemacs.org (8.8.5/8.8.5) with SMTP id NAA12424 for ; Tue, 20 May 1997 13:53:38 -0500 (CDT) Original-Received: from claymore.vcinet.com (claymore.vcinet.com [208.205.12.23]) by ifi.uio.no with SMTP (8.6.11/ifi2.4) id for ; Tue, 20 May 1997 19:39:46 +0200 Original-Received: (qmail 3179 invoked by uid 504); 20 May 1997 17:39:41 -0000 Original-Received: (qmail 3176 invoked from network); 20 May 1997 17:39:40 -0000 Original-Received: from waldorf.informatik.uni-dortmund.de (129.217.4.42) by claymore.vcinet.com with SMTP; 20 May 1997 17:39:40 -0000 Original-Received: from naunet.informatik.uni-dortmund.de (naunet.informatik.uni-dortmund.de [129.217.20.111]) by waldorf.informatik.uni-dortmund.de with SMTP id TAA13076; Tue, 20 May 1997 19:39:31 +0200 (MES) Original-Received: by naunet.informatik.uni-dortmund.de id TAA25629; Tue, 20 May 1997 19:39:30 +0200 Original-To: ding@gnus.org X-Mailer: Gnus v5.4.52/Emacs 19.34 Original-Lines: 113 Original-Xref: altair.xemacs.org dgnus-list:1391 Xref: main.gmane.org gmane.emacs.gnus.general:11005 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:11005 Hi, I hacked up the following to search the current newsgroup using glimpse. Beware: it only works with nnml groups! Situation: - You are indexing your home dir or your ~/Mail using glimpseindex every night. - You search for old mails using glimpse. - You would like to get a summary buffer of all the mails that glimpse found. Then, gnus-glimpse.el is for you! I bound it to "G G" in the summary buffer, so you can type "1 RET" to enter some huge group quickly. Then, you typ "G G" to have glimpse search for some articles. This piece is a quick and dirty hack and very slow, but performance will surely improve as soon as Lars implements the extra entry point that creates a summary buffer given a list of article numbers. I was too lazy to do this myself :-/ I'm posting this even though it doesn't really work, to get your opinions. Be aware that you are using something that has been tested on all of 1 (one) test case so far... Things to do: - Test it. - Make it faster. - Fetch old articles. - Better interface to glimpse (ideas, anyone?). kai -- Life is hard and then you die. ;; gnus-glimpse.el -- search current group with glimpse ;; University of Dortmund, Information Retrieval Group, CS Dept. ;; RCS Status : $Id$ ;; Author : Kai Grossjohann ;; Created On : Tue May 20 19:08:10 1997 ;; Last Modified By: ;; Last Modified On: ;; Update Count : 0 ;; Status : Unknown, Use with caution! (require 'gnus-sum) (defvar gnus-glimpse-program "/usr/local/bin/glimpse" "Path to glimpse program to run.") (defvar gnus-glimpse-options "-W -y -l" "Default options to pass to glimpse.") (defun gnus-glimpse-group-to-directory (group) "Return directory name for this group." (string-match "^nnml:\\(.*\\)$" group) (expand-file-name (concat nnml-directory (gnus-newsgroup-directory-form (substring group (match-beginning 1) (match-end 1)))))) (defun gnus-glimpse-group-option () "Return the string used as the group option for glimpse." (let ((s (gnus-glimpse-group-to-directory gnus-newsgroup-name))) (string-match (expand-file-name "~/") s) (concat "-F '" (replace-match "" nil nil s 0) "/[0-9]'"))) (defun gnus-summary-glimpse (glimpse-opt) (interactive "sGlimpse options: ") (let ((cmd (concat gnus-glimpse-program " " gnus-glimpse-options " " (gnus-glimpse-group-option) " " glimpse-opt)) (gnus-glimpse-articles nil) (num-articles nil) (cur-article 1)) (save-excursion (set-buffer (get-buffer-create " *glimpse output*")) (erase-buffer) (message "Running %s..." cmd) (sit-for 0) (shell-command cmd t) (message "Running %s...done" cmd) (sit-for 0) (goto-char (point-min)) (while (re-search-forward (concat "^" (gnus-glimpse-group-to-directory gnus-newsgroup-name) "/\\([0-9]*\\)$") nil t nil) (replace-match "\\1" nil nil)) (sort-numeric-fields 1 (point-min) (point-max)) (goto-char (point-min)) (insert "(setq gnus-glimpse-articles '(\n") (goto-char (point-max)) (insert "))") (eval-current-buffer) ) (setq num-articles (length gnus-glimpse-articles)) (message "Found %d articles." num-articles) (sit-for 0) (while gnus-glimpse-articles (setq cur-article (1+ cur-article)) (gnus-summary-goto-article (pop gnus-glimpse-articles) nil t)))) (define-key gnus-summary-goto-map "G" 'gnus-summary-glimpse) (provide 'gnus-glimpse) ;; gnus-glimpse.el ends here