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

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

Re: Restore window configuration after Ediff


From: PJ Weisberg
Subject: Re: Restore window configuration after Ediff
Date: Sun, 17 Apr 2011 11:09:08 -0700

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.



reply via email to

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