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

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

Re: Adding support for previous/next-error


From: Ted Zlatanov
Subject: Re: Adding support for previous/next-error
Date: Tue, 01 Dec 2009 09:31:50 -0600
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux)

On Mon, 30 Nov 2009 12:53:35 +0100 pjb@informatimago.com (Pascal J. 
Bourguignon) wrote: 

PJB> Nordlöw <per.nordlow@gmail.com> writes:
>> How do I add "support" for previous-error and next-error in my hits-
>> buffer showing output of from my grep-like scanning code implemented
>> in Emacs Lisp?

PJB> Customize the variable: compilation-error-regexp-alist

This will work iff that buffer derives from compilation-mode.

Otherwise, Nordlow needs to bind next-error-function in the buffer.  See
C-h v next-error:

"C-x ` normally uses the most recently started
compilation, grep, or occur buffer.  It can also operate on any
buffer with output from the <f5>, M-x grep commands, or,
more generally, on any buffer in Compilation mode or with
Compilation Minor mode enabled, or any buffer in which
`next-error-function' is bound to an appropriate function.
To specify use of a particular buffer for error messages, type
C-x ` in that buffer when it is the only one displayed
in the current frame.

Once C-x ` has chosen the buffer for error messages, it
runs `next-error-hook' with `run-hooks', and stays with that buffer
until you use it in some other buffer which uses Compilation mode
or Compilation Minor mode."

Note that next-error-function has very specific semantics so it can move
backwards with previous-error, etc.

So basically any buffer can serve as a next-error buffer.  Occur, grep,
and compilation implement that mechanism but it's intended to be
general and easy to support.

Ted


reply via email to

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