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

Start Ediff by other frame #34

Closed Qiu-Kejian closed 7 years ago

Qiu-Kejian commented 8 years ago

Hello. Thank you for this very nice package. Its so great.

I found it may be also convenient if there is an option allowing to start Ediff by other frame, in which case make it easier to switch back to ztree frame?

sinceree

Sorry, I would like to cancel this issues. It's possible to switch back to ztree buffer by winner-mode.

fourier commented 8 years ago

Hi, I don't think the task is really for ztree, but would be really glad if you can explain your use-case in details. If you've found the workaround suitable please let me know and I'll probably add it to the wiki (it will be the first entry then :) )

c02y commented 7 years ago
;; use new frame for ediff session and close the frame after exiting
(defvar pre-ediff-window-configuration nil
  "window configuration to use")
(defvar new-ediff-frame-to-use nil
  "new frame for ediff to use")
(defun save-my-window-configuration ()
  (interactive)
  (setq pre-ediff-window-configuration (current-window-configuration))
  (select-frame-set-input-focus (setq new-ediff-frame-to-use (new-frame)))
  (toggle-frame-maximized))
(add-hook 'ediff-before-setup-hook 'save-my-window-configuration)
(defun restore-my-window-configuration ()
  (interactive)
  (when (framep new-ediff-frame-to-use)
    (delete-frame new-ediff-frame-to-use)
    (setq new-ediff-frame-to-use nil))
  (when (window-configuration-p pre-ediff-window-configuration)
    (set-window-configuration pre-ediff-window-configuration)))
(add-hook 'ediff-after-quit-hook-internal 'restore-my-window-configuration)
;; quit the ediff without asking, unsaved buffer will remain
;; unmodified buffer will be killed
(defun disable-y-or-n-p (orig-fun &rest args)
  (cl-letf (((symbol-function 'y-or-n-p) (lambda (prompt) t)))
    (apply orig-fun args)))
(advice-add 'ediff-quit :around #'disable-y-or-n-p)