>> I'm thinking about adding 3 customizable options for >> next-error-find-buffer-function: >> >> 1. buffer-local - new default >> 2. window-local - useful for one window per each navigation buffer > > I'm not sure either can be congruent to all next-error-function > applications. Some next-error source buffers contain their own errors (so > buffer-local is natural), and others point to errors in other buffers > (supposing they can learn to open those in the same window, window-local > might be fitting). But both kinds are there, and all users deal with both. They can learn to open those in the same window by the patch below. >> 3. frame-local - old implicit default now separated into its own function > > That doesn't sound like a sufficient description: the old default also > includes visibility-based logic. So it's not just one value per frame. Do you think we should use the real frame-parameter? >>> In general, next-error can jump between windows, so window-local is not >>> a good fit for my mental model. >> >> It's bad when next-error unpredictably jumps between windows. >> I hope we could find a way to fix this erratic behavior. > > It basically a rule now that Grep opens errors in a different windows (so > that the Grep buffer stays visible). So erratic or not, multiple windows > are used routinely. This is improved by the same patch. >>> Do we need the buffer-local-ity changes to next-error-last-buffer for that? >>> Because if we do, that's okay, let's commit it and everything, but >>> otherwise I'd rather wait and look for a more elegant approach (for other >>> issues aside from this one). >> >> In the last previous patch, next-error visits next-error-find-buffer, >> calls next-error-function that possibly navigates to another buffer, >> then sets both global and buffer-local of next-error-last-buffer. >> This seems quite logical. And it works in all my tests. > > That... doesn't answer my question, I think. Or I didn't understand > the answer. > > So let me try again: is the new next-error-find-buffer stuff necessary to > fix the current bug? Or is suppressing the change to next-error-last-buffer > during next-error-function calls enough for that? The key point is (setq next-error-last-buffer) after (funcall next-error-function), not before. >>>> + (message "Showing another error from %s" next-error-last-buffer) >>> >>> Is it really "another"? Or maybe it's "current", "last" or "closest" error? >> >> Maybe just "Showing error from %s"? Or simply "Error from %s". >> Then we could simplify the above messages as well: "%s error from %s" >> for e.g. "Next error from %s", "Previous error from %s", ... > > Why not use "current" here as well? After all, we pass 0 to > next-error-function here. OK, here is the next patch: