[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tweaking grep-regexp-alist
From: |
troelskn |
Subject: |
Re: Tweaking grep-regexp-alist |
Date: |
Wed, 01 Aug 2007 21:42:45 -0000 |
User-agent: |
G2/1.0 |
On Jul 31, 8:07 am, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> troelskn wrote:
> > 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))))))
>
> Change your PHP script to include the file name in its output, or
> pipe its output through sed to insert the file name into the output.
That would obviously work, but I'd rather not, since it would make the
output unreadable.
I basically need to replace the following prompt with a default value:
Find this grep hit in (default *unknown*):
I have tried to dissect the code of grep.el, but to no avail.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Tweaking grep-regexp-alist,
troelskn <=