From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Valentin Baciu Newsgroups: gmane.emacs.help 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 Message-ID: References: <87sjl7tcxe.fsf@ambire.localdomain> <87d3caff1w.fsf@jidanni.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf303b39050f5eb604b2f00127 X-Trace: dough.gmane.org 1322643803 20981 80.91.229.12 (30 Nov 2011 09:03:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 30 Nov 2011 09:03:23 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: jidanni@jidanni.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 30 10:03:19 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RVg4V-0004li-Dm for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Nov 2011 10:03:19 +0100 Original-Received: from localhost ([::1]:38908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVg4U-0001dy-34 for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Nov 2011 04:03:18 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:42516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVg4O-0001ds-Mf for help-gnu-emacs@gnu.org; Wed, 30 Nov 2011 04:03:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVg4K-0000sI-8L for help-gnu-emacs@gnu.org; Wed, 30 Nov 2011 04:03:12 -0500 Original-Received: from mail-yw0-f41.google.com ([209.85.213.41]:52714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVg4K-0000s6-05 for help-gnu-emacs@gnu.org; Wed, 30 Nov 2011 04:03:08 -0500 Original-Received: by ywm14 with SMTP id 14so459109ywm.0 for ; Wed, 30 Nov 2011 01:03:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syntactic.org; s=syntacticorg; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Btbv+myCI9+LUC6GWhqU3OF4wkobYUsozqQxQ5tbSo0=; b=hyMdxb7DUk5w2EiRcTsK0imNJyZPMpLcMOgR2pS+YUXzXCKf5fBA+rL+nNQkMZtWUU 3ms/1ANZFuaSKUzyoQQM1r+emog0IcV9j+/6R9ZEFtinVu8k4qKsuia2KSn0dYX8htQC f/syMNVUC2tN8BnmLJV8MVkKuqwWPa5A+gIiY= Original-Received: by 10.236.145.72 with SMTP id o48mr1824617yhj.86.1322643786522; Wed, 30 Nov 2011 01:03:06 -0800 (PST) Original-Received: by 10.146.131.17 with HTTP; Wed, 30 Nov 2011 01:03:06 -0800 (PST) In-Reply-To: <87d3caff1w.fsf@jidanni.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.213.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83098 Archived-At: --20cf303b39050f5eb604b2f00127 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Nov 30, 2011 at 5:46 AM, wrote: > >>>>> "TN" == Thien-Thi Nguyen 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. --20cf303b39050f5eb604b2f00127 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Wed, Nov 30, 2011 at 5:46 AM, <jidanni@jidanni.org= > wrote:
>>>>> "TN" =3D=3D Thien-Thi Nguy= en <ttn@gnuvola.org> writes: TN> =A0 (add-to-list 'same-window-buffer-names "*compilation*&q= uot;)
It turns out that is not what I want. I want it to be the sole window= visible.
OK, I can use
(add-hook
=A0'compilation-mode-hook
=A0(function
=A0(lambda ()
=A0 =A0(switch-to-buffer "*compilation*");alas, forget using any= personal compilation-buffer-name-function
=A0 =A0(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 ca= ll 'switch-to-buffer. Also, the 'function' form is unnecessary = (in general, not just in this particular example). You could reduce your co= de to:

(add-hook 'compilation-mode-hook 'delete-other-= windows)

Now you can use the 'remove-hook func= tion if you decide you no longer need the hook; approach which does not wor= k when you add anonymous functions as hook functions.

--20cf303b39050f5eb604b2f00127--