unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* igrep mode incovenient compilation of results
@ 2013-08-01 22:22 Rami A
  2013-08-02  3:11 ` Kevin Rodgers
  2013-08-02 16:58 ` Rami A
  0 siblings, 2 replies; 4+ messages in thread
From: Rami A @ 2013-08-01 22:22 UTC (permalink / raw)
  To: help-gnu-emacs



I am using igrep.el package and liking it. There is one thing that bothers me though. In the igrep results page, the first and last lines are highlighted as part of the compilation and so cycling through the results using next-error will eventually hit these two lines with no corresponding files of course.

These are the format of these first and last files:

Igrep started at Thu Aug  1 15:15:23

finished (matches found) at Thu Aug  1 15:15:27

I believe that this is the code responsible for these lines to show up all together. How to disable these lines from showing in the grep results or at least not having them highlighted as part of the results:

(if igrep-find
(setq command
      (igrep-format-find-command command files)))
(cond ((eq igrep-save-buffers t) (save-some-buffers t))
  (igrep-save-buffers (save-some-buffers)))
(if (fboundp 'compilation-start)    ; Emacs 22
    (let ((compilation-process-setup-function 'grep-process-setup))
      (or (fboundp 'igrep-mode)
          (define-derived-mode igrep-mode grep-mode "Igrep"))
      (compilation-start command
                         'igrep-mode
                         nil
                         (cond ((eq compilation-highlight-regexp t))
                               (compilation-highlight-regexp
                                (if (eq program "fgrep")
                                    (regexp-quote regex)
                                  regex)))))
  (compile-internal command (format "No more %s matches" program)
                    "Igrep" nil grep-regexp-alist))))



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

* Re: igrep mode incovenient compilation of results
  2013-08-01 22:22 igrep mode incovenient compilation of results Rami A
@ 2013-08-02  3:11 ` Kevin Rodgers
  2013-08-02 16:58 ` Rami A
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2013-08-02  3:11 UTC (permalink / raw)
  To: help-gnu-emacs

On 8/1/13 4:22 PM, Rami A wrote:
> I am using igrep.el package and liking it. There is one thing that
> bothers me though. In the igrep results page, the first and last lines
> are highlighted as part of the compilation and so cycling through the
> results using next-error will eventually hit these two lines with no
> corresponding files of course.
>
> These are the format of these first and last files:
>
> Igrep started at Thu Aug  1 15:15:23
>
> finished (matches found) at Thu Aug  1 15:15:27

Does `M-x grep' generate those lines in the *grep* buffer?  Are they highlighted
and do they impact `M-x next-error' in the same way?

(BTW, Kenneth Goldman reported the same problem back in 2010.  Perhaps he knows
a solution.)

> I believe that this is the code responsible for these lines to show up
> all together. How to disable these lines from showing in the grep
> results or at least not having them highlighted as part of the
> results:

This code simply attempts to emulate `M-x grep', on the Emacs versions that
were popular when igrep was actively maintained (by me).  That emulation
probably needs to be updated to account for developments in grep.el and
compile.el since then.

> (if igrep-find
> (setq command
>        (igrep-format-find-command command files)))
> (cond ((eq igrep-save-buffers t) (save-some-buffers t))
>    (igrep-save-buffers (save-some-buffers)))
> (if (fboundp 'compilation-start)    ; Emacs 22
>      (let ((compilation-process-setup-function 'grep-process-setup))
>        (or (fboundp 'igrep-mode)
>            (define-derived-mode igrep-mode grep-mode "Igrep"))
>        (compilation-start command
>                           'igrep-mode
>                           nil
>                           (cond ((eq compilation-highlight-regexp t))
>                                 (compilation-highlight-regexp
>                                  (if (eq program "fgrep")
>                                      (regexp-quote regex)
>                                    regex)))))
>    (compile-internal command (format "No more %s matches" program)
>                      "Igrep" nil grep-regexp-alist))))

-- 
Kevin Rodgers
Denver, Colorado, USA




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

* Re: igrep mode incovenient compilation of results
  2013-08-01 22:22 igrep mode incovenient compilation of results Rami A
  2013-08-02  3:11 ` Kevin Rodgers
@ 2013-08-02 16:58 ` Rami A
  2013-08-05 22:26   ` Kevin Rodgers
  1 sibling, 1 reply; 4+ messages in thread
From: Rami A @ 2013-08-02 16:58 UTC (permalink / raw)
  To: help-gnu-emacs

Thank you for taking a look Kevin.
No grep doesnt show the same kind of behavior.
I actually found a solution by simply changing 'igrep-mode to 'grep-mode in this code:
>        (compilation-start command
>                           'igrep-mode
>                           nil 

And that did the trick.


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

* Re: igrep mode incovenient compilation of results
  2013-08-02 16:58 ` Rami A
@ 2013-08-05 22:26   ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2013-08-05 22:26 UTC (permalink / raw)
  To: help-gnu-emacs

On 8/2/13 10:58 AM, Rami A wrote:
> Thank you for taking a look Kevin.
> No grep doesnt show the same kind of behavior.
> I actually found a solution by simply changing 'igrep-mode to 'grep-mode in this code:
>>         (compilation-start command
>>                            'igrep-mode
>>                            nil
>
> And that did the trick.

Interesting, thanks!

I wonder why the preceding form is not enough, to allow igrep-mode to be
passed as the second arg to compilation-start?

           (or (fboundp 'igrep-mode)
               (define-derived-mode igrep-mode grep-mode "Igrep"))

-- 
Kevin Rodgers
Denver, Colorado, USA




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

end of thread, other threads:[~2013-08-05 22:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-01 22:22 igrep mode incovenient compilation of results Rami A
2013-08-02  3:11 ` Kevin Rodgers
2013-08-02 16:58 ` Rami A
2013-08-05 22:26   ` Kevin Rodgers

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).