[Top][All Lists]

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

Re: next-error-last-buffer

From: Juri Linkov
Subject: Re: next-error-last-buffer
Date: Wed, 12 May 2004 02:46:48 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Ted Zlatanov <address@hidden> writes:
> I'll be glad to help with suggestions and code to implement the
> changes you want in the next-error API.

The current implementation of next-error framework is general enough
to allow implementing different approaches easily (for example, I was
able to implement the desired behavior with only one small change in
the `next-error' function), but it is still not extensible enough.

Based on my recent experience, I want to make some suggestions
how to make it more extensible:

1. Add an option to allow the user to select among predefined
behaviors.  Though, this will not help the user if he will not
find a desired option in the predefined set.

2. Add a new user variable `next-error-find-buffer-function' and try
to call it (i.e. to call it if it's fbound and return its value,
but if it returns `nil', try other rules) in `next-error-find-buffer'
at the top precedence level before all other rules.  This will allow
the user to override the standard rules for finding the next-error
capable buffer with his own rule.

3. Add a hook to `next-error' after the `funcall next-error-function'
to allow the user to perform actions (such as setting buffer-local
variables) in the buffer found by `next-error-function'.

Making the next-error framework more extensible is only half the job.
Finding a good default behavior is no less important.

I thought again about why the current behavior is too confusing
and I think I found the reason: the most confusing is the fact that
the compilation buffer is visible in the window adjacent to the
source file window where the point is located, but typing C-x `
uses the last but not visible compilation buffer.

So w.r.t. `next-error-find-buffer' I propose to modify it to use the
following priority order:

1(new). Try to call a user-defined `next-error-find-buffer-function'.
2. If the current buffer is a next-error capable buffer, return it.
3(new). If a next-error capable buffer is in one of the windows
        of the current frame, return it.
4. If next-error-last-buffer is set to a live buffer, use that.
5. Otherwise, look for a next-error capable buffer
6. Signal an error if there are none.

Juri Linkov

reply via email to

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