Function: ediff-dispose-of-variant-according-to-user

ediff-dispose-of-variant-according-to-user is a byte-compiled function defined in ediff-util.el.gz.

Signature

(ediff-dispose-of-variant-according-to-user BUFF BUFFTYPE ASK KEEP-VARIANTS)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
;; Kill the variant buffer, according to user directives (ask, kill
;; unconditionally, keep)
;; BUFF is the buffer, BUFF-TYPE is either 'A, or 'B, 'C, 'Ancestor
(defun ediff-dispose-of-variant-according-to-user (buff bufftype ask keep-variants)
  ;; if this is indirect buffer, kill it and substitute with direct buf
  (if (and (ediff-buffer-live-p buff)
	   (ediff-with-current-buffer buff ediff-temp-indirect-buffer))
      (let ((wind (ediff-get-visible-buffer-window buff))
	    (base (buffer-base-buffer buff))
	    (modified-p (buffer-modified-p buff)))
	(if (and (window-live-p wind) (ediff-buffer-live-p base))
	    (set-window-buffer wind base))
	;; Kill indirect buffer even if it is modified, because the base buffer
	;; is still there. Note that if the base buffer is dead then so will be
	;; the indirect buffer
	(ediff-with-current-buffer buff
	  (set-buffer-modified-p nil))
	(ediff-kill-buffer-carefully buff)
	(ediff-with-current-buffer base
	  (set-buffer-modified-p modified-p)))
    ;; otherwise, ask or use the value of keep-variants
    (or (not (ediff-buffer-live-p buff))
	keep-variants
	(buffer-modified-p buff)
	(and ask
	     (not (y-or-n-p (format "Kill buffer %S [%s]? "
				    bufftype (buffer-name buff)))))
	(ediff-kill-buffer-carefully buff))
    ))