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

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

Want next-error to move current "hit" to the top of the window -- why do


From: Vincent Montressor
Subject: Want next-error to move current "hit" to the top of the window -- why doesn't this next-error-hook work?
Date: Thu, 15 Sep 2011 15:18:19 -0700 (PDT)

I'd like it if next-error moved the current "hit" to the top of the next-error 
(compilation, grep, etc.) window.  So I tried making this hook function, which 
I thought would do that:

  (add-hook 'next-error-hook
            '(lambda ()
               (when next-error-last-buffer
                 (save-excursion
                   (switch-to-buffer-other-window next-error-last-buffer)
                   (recenter 0))
                 (other-window))))

This sort of works, but point is in the next-error (compilation, grep, etc.) 
window after it's done, whether or not I do the (other-window) at the end, and 
I'd like point to be in the source window instead (as it is when I don't 
execute this hook function).  I'm puzzled by the failure of (other-window) to 
solve this problem for me.  Is there a better way to do it?




reply via email to

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