Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-glimpse.el -- search a newsgroup using glimpse
@ 1997-05-20 17:39 Kai Grossjohann
  1997-05-22 23:14 ` Mark Eichin
  2000-11-09 16:34 ` Norman Walsh
  0 siblings, 2 replies; 14+ messages in thread
From: Kai Grossjohann @ 1997-05-20 17:39 UTC (permalink / raw)
  Cc: Michael.Huehne, Ulrich Pfeifer

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
                           


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2000-11-10 16:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-05-20 17:39 gnus-glimpse.el -- search a newsgroup using glimpse Kai Grossjohann
1997-05-22 23:14 ` Mark Eichin
1997-05-23  7:56   ` Kai Grossjohann
1997-05-23 17:09   ` Greg Stark
1997-05-24  4:09     ` Lars Magne Ingebrigtsen
1997-05-25  0:13       ` Kai Grossjohann
1997-05-25  0:18       ` Kai Grossjohann
1997-05-25  0:03     ` Kai Grossjohann
1997-05-23 19:08   ` Mark Eichin
2000-11-09 16:34 ` Norman Walsh
2000-11-09 18:09   ` Kai Großjohann
2000-11-09 18:47     ` Norman Walsh
2000-11-09 19:23       ` Francisco Solsona
2000-11-10 16:23     ` Norman Walsh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).