Function: ediff-operate-on-windows

ediff-operate-on-windows is a byte-compiled function defined in ediff-util.el.gz.

Signature

(ediff-operate-on-windows OPERATION ARG)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
;; Window scrolling operations

;; Performs some operation on the two file windows (if they are showing).
;; Traps all errors on the operation in windows A/B/C.
;; Usually, errors come from scrolling off the
;; beginning or end of the buffer, and this gives error messages.
(defun ediff-operate-on-windows (operation arg)

  ;; make sure windows aren't dead
  (unless (and (window-live-p ediff-window-A) (window-live-p ediff-window-B))
    (ediff-recenter 'no-rehighlight))
  (if (not (and (ediff-buffer-live-p ediff-buffer-A)
		(ediff-buffer-live-p ediff-buffer-B)
		(or (not ediff-3way-job) (ediff-buffer-live-p ediff-buffer-C))
		(or (not ediff-merge-with-ancestor-job)
                    (not ediff-show-ancestor)
                    (ediff-buffer-live-p ediff-ancestor-buffer))
		))
      (error ediff-KILLED-VITAL-BUFFER))

  (let* ((wind-A ediff-window-A)
	 (wind-B ediff-window-B)
	 (wind-C ediff-window-C)
	 (wind-Anc ediff-window-Ancestor)
	 (coefA (ediff-get-region-size-coefficient 'A operation))
	 (coefB (ediff-get-region-size-coefficient 'B operation))
	 (three-way ediff-3way-job)
         (with-Ancestor (and ediff-merge-with-ancestor-job ediff-show-ancestor))
	 (coefC (if three-way
		    (ediff-get-region-size-coefficient 'C operation)))
         (coefAnc (if with-Ancestor
                      (ediff-get-region-size-coefficient 'Ancestor operation))))

    (ediff-with-live-window wind-A
      (ignore-errors (funcall operation (round (* coefA arg)))))
    (ediff-with-live-window wind-B
      (ignore-errors (funcall operation (round (* coefB arg)))))
    (when three-way
      (ediff-with-live-window wind-C
        (ignore-errors (funcall operation (round (* coefC arg))))))
    (when with-Ancestor
      (ediff-with-live-window wind-Anc
        (ignore-errors (funcall operation (round (* coefAnc arg))))))))