unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Tweaking grep-regexp-alist
@ 2007-07-27 12:13 troelskn
  2007-07-28 13:23 ` Peter Dyballa
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: troelskn @ 2007-07-27 12:13 UTC (permalink / raw)
  To: help-gnu-emacs

Hi

I have an external program, which analyses a file, and returns a list
of line-numbers for matches. I've written a wrapper-function in elisp,
which runs the program and loads the result into a buffer, and sets it
in grep-mode. So far, so good, but the format of the results doesn't
follow the standard grep. I nailed it down to modifying grep-regexp-
alist, but there is one thing I can't figure out. Since the results
are all from one file, there is no filename listed on each line, only
a linenumber. So I need to make grep always jump to the same file
(Which I know at the time, I create the buffer, and put it into grep-
mode). Any ideas?

Just in case, I didn't explain myself clearly, here's the code, I have
already:

(defun php-mode-list-tokens ()
  "Lists tokens for a PHP-file"
  (interactive)
  (let* ((buffername "*php-mode-tokens*")
        (filename (buffer-file-name)))
    (when (get-buffer buffername)
      (kill-buffer buffername))
    (save-excursion
      (pop-to-buffer buffername)
      (shell-command (format "php %s %s"
                             (shell-quote-argument "~/scripts/
tokens.php")
                             (shell-quote-argument filename))
buffername buffername)
      (grep-mode)
      (setq grep-regexp-alist
            '(("^\\([0-9]+\\)[ ]+" nil 1))))))

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

end of thread, other threads:[~2007-08-01 21:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27 12:13 Tweaking grep-regexp-alist troelskn
2007-07-28 13:23 ` Peter Dyballa
     [not found] ` <mailman.4079.1185629031.32220.help-gnu-emacs@gnu.org>
2007-07-28 15:56   ` troelskn
2007-07-31  6:07 ` Kevin Rodgers
     [not found] ` <mailman.4150.1185862211.32220.help-gnu-emacs@gnu.org>
2007-08-01 21:42   ` troelskn

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 read-only IMAP folder(s) and NNTP newsgroup(s).