all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: PJ Weisberg <pj@irregularexpressions.net>
To: Allan Gottlieb <gottlieb@nyu.edu>,
	help-gnu-emacs <Help-gnu-emacs@gnu.org>
Subject: Re: Restore window configuration after Ediff
Date: Sun, 17 Apr 2011 11:09:08 -0700	[thread overview]
Message-ID: <BANLkTim9th5Hd-sfgg3C1T2PjgmqtudJDw@mail.gmail.com> (raw)
In-Reply-To: <yu9y639d2yl.fsf@nyu.edu>

On Sat, Apr 16, 2011 at 7:30 PM, Allan Gottlieb <gottlieb@nyu.edu> 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.  I'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:
>>
>> ======================================================================
>> (defvar saved-configuration nil)
>>
>> (defun do-ediff()
>>   (interactive)
>>   (add-hook 'ediff-quit-hook 'do-ediff-cleanup)
>>   (setq saved-configuration (current-window-configuration))
>>   (ediff-buffers "*scratch*" "*scratch*"))
>>
>> (defun do-ediff-cleanup()
>>   (set-window-configuration saved-configuration)
>>   (remove-hook 'ediff-quit-hook 'do-ediff-cleanup))
>> ======================================================================
>>
>> 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.  Do you remove it from the
> 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.



  parent reply	other threads:[~2011-04-17 18:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15 22:33 Restore window configuration after Ediff PJ Weisberg
     [not found] ` <yu9y639d2yl.fsf@nyu.edu>
2011-04-17 18:09   ` PJ Weisberg [this message]
2011-04-18 17:31 ` Guilherme Gondim
  -- strict thread matches above, loose matches on Subject: below --
2011-04-16  7:36 martin rudalics
2011-04-16  8:33 ` PJ Weisberg
2011-04-16 10:08   ` martin rudalics
2011-04-16 18:26     ` PJ Weisberg
2011-04-17 10:24       ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTim9th5Hd-sfgg3C1T2PjgmqtudJDw@mail.gmail.com \
    --to=pj@irregularexpressions.net \
    --cc=Help-gnu-emacs@gnu.org \
    --cc=gottlieb@nyu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.