From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/13574 Path: main.gmane.org!not-for-mail From: Kai Grossjohann Newsgroups: gmane.emacs.gnus.general Subject: Re: Searching mail folders? Date: 12 Jan 1998 19:38:15 +0100 Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1035152914 9912 80.91.224.250 (20 Oct 2002 22:28:34 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 22:28:34 +0000 (UTC) Cc: ding@gnus.org Return-Path: Original-Received: from xemacs.org (xemacs.cs.uiuc.edu [128.174.252.16]) by altair.xemacs.org (8.8.8/8.8.8) with ESMTP id KAA07925 for ; Mon, 12 Jan 1998 10:37:03 -0800 Original-Received: from sina.hpc.uh.edu (Sina.HPC.UH.EDU [129.7.3.5]) by xemacs.org (8.8.5/8.8.5) with ESMTP id MAA20225 for ; Mon, 12 Jan 1998 12:39:47 -0600 (CST) Original-Received: from sina.hpc.uh.edu (Sina.HPC.UH.EDU [129.7.3.5]) by sina.hpc.uh.edu (8.7.3/8.7.3) with ESMTP id MAH20625; Mon, 12 Jan 1998 12:40:00 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 12 Jan 1998 12:38:41 -0600 (CST) Original-Received: from claymore.vcinet.com (claymore.vcinet.com [208.205.12.23]) by sina.hpc.uh.edu (8.7.3/8.7.3) with SMTP id MAA20605 for ; Mon, 12 Jan 1998 12:38:32 -0600 (CST) Original-Received: (qmail 22553 invoked by uid 504); 12 Jan 1998 18:38:20 -0000 Original-Received: (qmail 22550 invoked from network); 12 Jan 1998 18:38:19 -0000 Original-Received: from waldorf.informatik.uni-dortmund.de (129.217.4.42) by claymore.vcinet.com with SMTP; 12 Jan 1998 18:38:19 -0000 Original-Received: from petty.informatik.uni-dortmund.de (petty.informatik.uni-dortmund.de [129.217.20.161]) by waldorf.informatik.uni-dortmund.de with SMTP id TAA29513; Mon, 12 Jan 1998 19:38:17 +0100 (MET) Original-Received: by petty.informatik.uni-dortmund.de id TAA22242; Mon, 12 Jan 1998 19:38:16 +0100 Original-To: Simon Josefsson In-Reply-To: Simon Josefsson's message of 12 Jan 1998 18:15:18 +0100 Original-Lines: 122 X-Mailer: Gnus v5.5/Emacs 20.2 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:13574 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:13574 >>>>> On 12 Jan 1998, Simon Josefsson said: Simon> After using grep to search through my mail folders for some Simon> months, I've started using Glimpse Simon> (). I think it's very Simon> neat. Even neater would be to interface it somehow with Gnus. Here's gnus-glimpse.el which almost doesn't work at all but is useful to me nevertheless. Feel free to improve on it. I wish I could get around to looking at nnweb.el to see how things ought to work! I index my whole home dir with a cron job every night. kai -- Kai Grossjohann, Informatik VI grossjohann@ls6.cs.uni-dortmund.de Uni Dortmund, D-44221 Dortmund http://ls6-www.cs.uni-dortmund.de/ Vox +49 231 755 5670, Fax -2405 OOA: object oriented analysis OOD: object oriented design OOP: object oriented programming OOPS: object oriented mistakes ;; 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 "/app/sun4_55/unido-inf/glimpse/default/bin/glimpse" "Path to glimpse program to run.") (defvar gnus-glimpse-options "-W -y -l" "Default options to pass to glimpse.") (defvar gnus-glimpse-home-option-function nil "You can set this to a function which should return a glimpse option. This can be used for per-group glimpse index files. Just set this to a function that returns -H , for instance. The function `gnus-glimpse-home-option-per-group' is provided as an example.") (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-glimpse-home-option-per-group () "Returns an option for Glimpse to search its index files in the directory of the group. Can be used as a value for `gnus-glimpse-home-option-function'." (let ((s (gnus-glimpse-group-to-directory gnus-newsgroup-name))) (concat "-H '" s "'"))) (defun gnus-glimpse-home-option () "If `gnus-glimpse-home-option-function' is set, call the function specified. Otherwise, return an empty string." (if gnus-glimpse-home-option-function (apply gnus-glimpse-home-option-function nil) "")) (defun gnus-summary-glimpse (glimpse-opt) (interactive "sGlimpse options: ") (let ((cmd (concat gnus-glimpse-program " " gnus-glimpse-options " " (gnus-glimpse-group-option) " " (gnus-glimpse-home-option) " " glimpse-opt)) ;; gnus-newsgroup-name must be read in the summary buffer. So ;; we do it here which is before switching to the glimpse ;; output buffer. (newsgroup-name gnus-newsgroup-name) (gnus-glimpse-articles nil) (num-articles nil) (cur-article 1)) (save-excursion ;; Can't read gnus-newsgroup-name after the following line. (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 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-subject (pop gnus-glimpse-articles) t t)) (sit-for 0))) (define-key gnus-summary-goto-map "G" 'gnus-summary-glimpse) (provide 'gnus-glimpse) ;; gnus-glimpse.el ends here