all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* matching different line number format in grep-mode
@ 2012-06-21 12:55 Jim Newton
  2012-06-25 16:04 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Newton @ 2012-06-21 12:55 UTC (permalink / raw)
  To: help-gnu-emacs

I have an application which prints line number information not in the standard grep format but as follows.

at line 302 in file /full/path/to/file.ext

Is there something I can do to the variable compilation-error-regexp-alist-alist
which will cause grep-mode to also find these lines?  

I see the pattern when I look at the variable, but what's the flow to make either grep-mode or some other mode actually find these lines on next-error ?

Jim


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

* Re: matching different line number format in grep-mode
  2012-06-21 12:55 matching different line number format in grep-mode Jim Newton
@ 2012-06-25 16:04 ` Stefan Monnier
  2012-06-27  8:31   ` Jim Newton
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2012-06-25 16:04 UTC (permalink / raw)
  To: help-gnu-emacs

> I have an application which prints line number information not in the
> standard grep format but as follows.

> at line 302 in file /full/path/to/file.ext

> Is there something I can do to the variable compilation-error-regexp-alist-alist
> which will cause grep-mode to also find these lines?  

Does it have to be grep-mode?  If you can use compilation-mode, than
adding the relevant regexp to compilation-error-regexp-alist should
be sufficient.  Otherwise you might want to use define-compilation-mode.


        Stefan


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

* Re: matching different line number format in grep-mode
  2012-06-25 16:04 ` Stefan Monnier
@ 2012-06-27  8:31   ` Jim Newton
  2012-06-27 11:41     ` Aurélien Aptel
  2012-06-27 15:53     ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Jim Newton @ 2012-06-27  8:31 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks Stephan, this is on the right track.

can you show me how to do this with define-compilation-mode?

Jim


On Monday, June 25, 2012 6:04:57 PM UTC+2, Stefan Monnier wrote:
> > I have an application which prints line number information not in the
> > standard grep format but as follows.
> 
> > at line 302 in file /full/path/to/file.ext
> 
> > Is there something I can do to the variable compilation-error-regexp-alist-alist
> > which will cause grep-mode to also find these lines?  
> 
> Does it have to be grep-mode?  If you can use compilation-mode, than
> adding the relevant regexp to compilation-error-regexp-alist should
> be sufficient.  Otherwise you might want to use define-compilation-mode.


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

* Re: matching different line number format in grep-mode
  2012-06-27  8:31   ` Jim Newton
@ 2012-06-27 11:41     ` Aurélien Aptel
  2012-06-27 15:53     ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Aurélien Aptel @ 2012-06-27 11:41 UTC (permalink / raw)
  To: Jim Newton; +Cc: help-gnu-emacs

On Wed, Jun 27, 2012 at 10:31 AM, Jim Newton
<jimka.velizy@googlemail.com> wrote:
> can you show me how to do this with define-compilation-mode?

I don't know what define-compilation-mode is, but why can't you use
the compilation-mode and the compilation-error-regexp-alist variable?

Eval this in your scratch buffer (select everything and run M-x eval-region):

    (require 'compile)
    (add-to-list 'compilation-error-regexp-alist '("^at line
\\([0-9]+\\) in file \\(.+\\)$" 2 1))

I've used this as a test (it works):
M-x compile RET echo at line 42 in file /foo/bar RET

To make it permanent you can add this to your .emacs:

    (eval-after-load "compile"
      '(add-to-list 'compilation-error-regexp-alist '("^at line
\\([0-9]+\\) in file \\(.+\\)$" 2 1)))

You have to use eval-after-load in your .emacs because the variable
compilation-...-alist is defined only once compile.el is loaded. And
it is automatically loaded when you call M-x compile or any autoloaded
function in compile.el (the ones with the ;;;###autoload cookie
above).

Alternatively you could just copy what you've pasted in *scratch* in
your .emacs but it load compile.el every time you start emacs i.e. it
will slightly slowdown your emacs startup time.

I'm sorry if all of this is obvious to you.



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

* Re: matching different line number format in grep-mode
  2012-06-27  8:31   ` Jim Newton
  2012-06-27 11:41     ` Aurélien Aptel
@ 2012-06-27 15:53     ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2012-06-27 15:53 UTC (permalink / raw)
  To: help-gnu-emacs

> can you show me how to do this with define-compilation-mode?

I'd suggest you try: C-h f grep-mode RET and then to click on "grep.el"
to jump to the definition of grep-mode, which is done with
define-compilation-mode and should be a good example to copy.


        Stefan


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

end of thread, other threads:[~2012-06-27 15:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-21 12:55 matching different line number format in grep-mode Jim Newton
2012-06-25 16:04 ` Stefan Monnier
2012-06-27  8:31   ` Jim Newton
2012-06-27 11:41     ` Aurélien Aptel
2012-06-27 15:53     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.