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

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

Re: all I wanted to do was make the compilation-mode-hook the sole visib


From: Valentin Baciu
Subject: Re: all I wanted to do was make the compilation-mode-hook the sole visible buffer
Date: Wed, 30 Nov 2011 11:03:06 +0200

On Wed, Nov 30, 2011 at 5:46 AM, <address@hidden> wrote:
>>>>> "TN" == Thien-Thi Nguyen <address@hidden> 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.


reply via email to

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