fourier / ztree

Directory tree comparison mode for Emacs
http://www.emacswiki.org/emacs/ZtreeDiff
GNU General Public License v3.0
239 stars 21 forks source link

On how to jump back to ztree after using ediff (from within ztree) #38

Closed mpettigr closed 6 years ago

mpettigr commented 7 years ago

I like the visual feedback from ztree rather than ediff-directories. But running ediff from ztree leaves you in the 2 buffers you're "ediffing" when you quit out of ediff.

Here's how to tweak emacs to return back to ztree when you're done. Note: The ztree buffer gets mangled at least on my linux emacs 24.5.1 so you need to refresh the ztree buffer to see what's going on but that's just pressing 'g' in the ztree buffer.

abo-abo provides the most excellent advice on how to restore windows and layout after an ediff session at http://emacs.stackexchange.com/questions/7482/restoring-windows-and-layout-after-an-ediff-session

To get his approach to work with ztree, you just need to create defadvice for ediff ( in addition to ediff-buffers).

(defvar ediff-last-windows nil "Last ediff window configuration.")

(defun ediff-restore-windows () "Restore window configuration to `ediff-last-windows'." (set-window-configuration ediff-last-windows) (remove-hook 'ediff-after-quit-hook-internal 'ediff-restore-windows))

(defadvice ediff-buffers (around ediff-restore-windows activate) (setq ediff-last-windows (current-window-configuration)) (add-hook 'ediff-after-quit-hook-internal 'ediff-restore-windows) ad-do-it)

(defadvice ediff (around ediff-restore-windows activate) (setq ediff-last-windows (current-window-configuration)) (add-hook 'ediff-after-quit-hook-internal 'ediff-restore-windows) ad-do-it)


scratch itched. :-)

fourier commented 7 years ago

@mpettigr Hi, could you please verify if the latest version fixes your issue.

fourier commented 6 years ago

@mpettigr could you please add your description to the wiki? If it is possible. Otherwise I'll add it by myself.