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
  (if (not (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 (selected-window))
	 (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))))

    (select-window wind-A)
    (condition-case nil
	(funcall operation (round (* coefA arg)))
      (error))
    (select-window wind-B)
    (condition-case nil
	(funcall operation (round (* coefB arg)))
      (error))
    (if three-way
	(progn
	  (select-window wind-C)
	  (condition-case nil
	      (funcall operation (round (* coefC arg)))
	    (error))))
    (when with-Ancestor
      (select-window wind-Anc)
      (condition-case nil
          (funcall operation (round (* coefAnc arg)))
        (error)))
    (select-window wind)))