all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Aurélien Aptel" <aurelien.aptel+emacs@gmail.com>
To: Jim Newton <jimka.velizy@googlemail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: matching different line number format in grep-mode
Date: Wed, 27 Jun 2012 13:41:38 +0200	[thread overview]
Message-ID: <CA+5B0FPKbOtDrxO_1=RV9HUYyEgKyWa-An0Xr+FnLfJMTU0Auw@mail.gmail.com> (raw)
In-Reply-To: <e3b09353-49cd-4fcc-9988-e093f1e42cf2@googlegroups.com>

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.



  reply	other threads:[~2012-06-27 11:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-06-27 15:53     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+5B0FPKbOtDrxO_1=RV9HUYyEgKyWa-An0Xr+FnLfJMTU0Auw@mail.gmail.com' \
    --to=aurelien.aptel+emacs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=jimka.velizy@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.