On Wed, Nov 30, 2011 at 5:46 AM,
<jidanni@jidanni.org> wrote:
>>>>> "TN" == Thien-Thi Nguyen <
ttn@gnuvola.org> writes:
TN> (add-to-list 'same-window-buffer-names "*compilation*")
It turns out that is not what I want. I want it to be the sole window visible.
OK, I can use
(add-hook
'compilation-mode-hook
(function
(lambda ()
(switch-to-buffer "*compilation*");alas, forget using any personal compilation-buffer-name-function
(delete-other-windows))))
I believe that the hook function will be executed in the context of the compilation buffer so you may not need to call 'switch-to-buffer. Also, the 'function' form is unnecessary (in general, not just in this particular example). You could reduce your code to:
(add-hook 'compilation-mode-hook 'delete-other-windows)
Now you can use the 'remove-hook function if you decide you no longer need the hook; approach which does not work when you add anonymous functions as hook functions.