Function: ediff-maybe-save-and-delete-merge

ediff-maybe-save-and-delete-merge is a byte-compiled function defined in ediff-util.el.gz.

Signature

(ediff-maybe-save-and-delete-merge &optional SAVE-AND-CONTINUE)

Documentation

Default hook to run on quitting a merge job.

This can also be used to save merge buffer in the middle of an Ediff session.

If the optional SAVE-AND-CONTINUE argument is non-nil, save merge buffer and continue. Otherwise: If ediff-autostore-merges is nil, this does nothing. If it is t, it saves the merge buffer in the file ediff-merge-store-file or asks the user, if the latter is nil. It then asks the user whether to delete the merge buffer. If ediff-autostore-merges is neither nil nor t, the merge buffer is saved only if this merge job is part of a group, i.e., was invoked from within ediff-merge-directories, ediff-merge-directory-revisions, and such.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
(defun ediff-maybe-save-and-delete-merge (&optional save-and-continue)
  "Default hook to run on quitting a merge job.
This can also be used to save merge buffer in the middle of an Ediff session.

If the optional SAVE-AND-CONTINUE argument is non-nil, save merge buffer and
continue.  Otherwise:
If `ediff-autostore-merges' is nil, this does nothing.
If it is t, it saves the merge buffer in the file `ediff-merge-store-file'
or asks the user, if the latter is nil.  It then asks the user whether to
delete the merge buffer.
If `ediff-autostore-merges' is neither nil nor t, the merge buffer is saved
only if this merge job is part of a group, i.e., was invoked from within
`ediff-merge-directories', `ediff-merge-directory-revisions', and such."
  (let ((merge-store-file ediff-merge-store-file)
	(ediff-autostore-merges ; fake ediff-autostore-merges, if necessary
	 (if save-and-continue t ediff-autostore-merges)))
    (if ediff-autostore-merges
	(cond ((stringp merge-store-file)
	       ;; store, ask to delete
	       (ediff-write-merge-buffer-and-maybe-kill
		ediff-buffer-C merge-store-file 'show-file save-and-continue))
	      ((eq ediff-autostore-merges t)
	       ;; ask for file name
	       (setq merge-store-file
		     (read-file-name "Save the result of the merge in file: "))
	       (ediff-write-merge-buffer-and-maybe-kill
		ediff-buffer-C merge-store-file nil save-and-continue))
	      ((and (ediff-buffer-live-p ediff-meta-buffer)
		    (ediff-with-current-buffer ediff-meta-buffer
		      (ediff-merge-metajob)))
	       ;; The parent metajob passed nil as the autostore file.
	       nil)))
    ))