help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When grep-find, show the count of matches


From: Kevin Rodgers
Subject: Re: When grep-find, show the count of matches
Date: Mon, 28 Jun 2010 23:04:36 -0600
User-agent: Thunderbird 2.0.0.24 (Macintosh/20100228)

Tim Landscheidt wrote:
...
No, you should defadvice *around* grep-process-setup, copy
the whole original from the Emacs distribution, and replace
the lambda construct in:

|   (set (make-local-variable 'compilation-exit-message-function)
|        (lambda (status code msg)
|          (if (eq status 'exit)
|              (cond ((zerop code)
|                     '("finished (matches found)\n" . "matched"))
|                    ((= code 1)
|                     '("finished with no matches found\n" . "no match"))
|                    (t
|                     (cons msg code)))
|            (cons msg code))))

with another that inserts the number of matches into the
buffer.

Copying the grep-process-setup function definition defeats the purpose of
defadvice.  As the function's doc string suggests, this is what grep-setup-hook
is intended for (resetting compilation-exit-message-function).

--
Kevin Rodgers
Denver, Colorado, USA




reply via email to

[Prev in Thread] Current Thread [Next in Thread]