From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: PJ Weisberg Newsgroups: gmane.emacs.help Subject: Re: Restore window configuration after Ediff Date: Sun, 17 Apr 2011 11:09:08 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1303063767 11186 80.91.229.12 (17 Apr 2011 18:09:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 17 Apr 2011 18:09:27 +0000 (UTC) To: Allan Gottlieb , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 17 20:09:24 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 1QBWPS-0002eo-8T for geh-help-gnu-emacs@m.gmane.org; Sun, 17 Apr 2011 20:09:22 +0200 Original-Received: from localhost ([::1]:47838 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBWPR-0004Pt-FG for geh-help-gnu-emacs@m.gmane.org; Sun, 17 Apr 2011 14:09:21 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:44619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBWPL-0004Pm-Ql for Help-gnu-emacs@gnu.org; Sun, 17 Apr 2011 14:09:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QBWPK-0008Nt-OG for Help-gnu-emacs@gnu.org; Sun, 17 Apr 2011 14:09:15 -0400 Original-Received: from p3plsmtpa01-10.prod.phx3.secureserver.net ([72.167.82.90]:58951) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QBWPK-0008Ng-Ex for Help-gnu-emacs@gnu.org; Sun, 17 Apr 2011 14:09:14 -0400 Original-Received: (qmail 22854 invoked from network); 17 Apr 2011 18:09:11 -0000 Original-Received: from unknown (209.85.161.41) by p3plsmtpa01-10.prod.phx3.secureserver.net (72.167.82.90) with ESMTP; 17 Apr 2011 18:09:10 -0000 Original-Received: by fxm18 with SMTP id 18so3363799fxm.0 for ; Sun, 17 Apr 2011 11:09:08 -0700 (PDT) Original-Received: by 10.223.100.86 with SMTP id x22mr1965148fan.108.1303063748834; Sun, 17 Apr 2011 11:09:08 -0700 (PDT) Original-Received: by 10.223.78.195 with HTTP; Sun, 17 Apr 2011 11:09:08 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 72.167.82.90 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:80819 Archived-At: On Sat, Apr 16, 2011 at 7:30 PM, Allan Gottlieb wrote: > On Fri, Apr 15 2011, PJ Weisberg wrote: > >> I'm not 100% sure if this is a bug or if I'm trying to do something I >> should try to do. =A0I'm trying to call ediff-buffers and then use a >> hook to restore the frame to its original state after Ediff is done. >> Here's some sample code: >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> (defvar saved-configuration nil) >> >> (defun do-ediff() >> =A0 (interactive) >> =A0 (add-hook 'ediff-quit-hook 'do-ediff-cleanup) >> =A0 (setq saved-configuration (current-window-configuration)) >> =A0 (ediff-buffers "*scratch*" "*scratch*")) >> >> (defun do-ediff-cleanup() >> =A0 (set-window-configuration saved-configuration) >> =A0 (remove-hook 'ediff-quit-hook 'do-ediff-cleanup)) >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> The problem is that after I quit ediff, the ediff control frame >> doesn't always disappear. >> >> I get the behavior I want if I use ediff-after-quit-hook-internal >> instead of ediff-quit-hook, but the "internal" part of that name tells >> me that's a bad idea. >> >> Is there a better way to accomplish what I'm trying to do? >> >> -PJ > > I think ediff-cleanup-mess is supposed to remove the control buffer. > It seems to be by default on ediff-quit-hook. =A0Do you remove it from th= e > hook or stop it from being executed? Ah-ha! Figured it out. My hook has to run *after* ediff-cleanup-mess, because ediff-cleanup-mess depends on some buffer-local variables and my code changes which buffer is current. So adding a third argument to add-hook fixes the problem.