Function: ediff-clone-buffer-for-region-comparison

ediff-clone-buffer-for-region-comparison is a byte-compiled function defined in ediff-util.el.gz.

Signature

(ediff-clone-buffer-for-region-comparison BUFF REGION-NAME)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
;; idea suggested by Hannu Koivisto <azure@iki.fi>
(defun ediff-clone-buffer-for-region-comparison (buff region-name)
  (let ((cloned-buff (ediff-make-cloned-buffer buff region-name))
	(pop-up-windows t)
	wind
	other-wind
	msg-buf)
    (ediff-with-current-buffer cloned-buff
      (setq ediff-temp-indirect-buffer t))
    (pop-to-buffer cloned-buff)
    (setq wind (ediff-get-visible-buffer-window cloned-buff))
    (select-window wind)
    (delete-other-windows)
    (or (mark) (push-mark))
    (setq mark-active 'ediff-util)
    (setq-local transient-mark-mode t)
    (split-window-vertically)
    (ediff-select-lowest-window)
    (setq other-wind (selected-window))
    (with-temp-buffer
      (erase-buffer)
      (insert
       (format "\n   *******  Mark a region in buffer %s (or confirm the existing one)  *******\n"
	       (buffer-name cloned-buff)))
      (insert
       (ediff-with-current-buffer buff
	 (format "\n\t      When done, type %s       Use %s to abort\n    "
		 (ediff-format-bindings-of 'exit-recursive-edit)
		 (ediff-format-bindings-of 'abort-recursive-edit))))
      (goto-char (point-min))
      (setq msg-buf (current-buffer))
      (set-window-buffer other-wind msg-buf)
      (shrink-window-if-larger-than-buffer)
      (if (window-live-p wind)
	  (select-window wind))
      (condition-case nil
	  (recursive-edit)
	(quit
	 (ediff-kill-buffer-carefully cloned-buff)))
      )
    cloned-buff))