Function: ediff-recenter

ediff-recenter is an interactive and byte-compiled function defined in ediff-util.el.gz.

Signature

(ediff-recenter &optional NO-REHIGHLIGHT)

Documentation

Bring the highlighted region of all buffers being compared into view.

Reestablish the default window display.

If optional NO-REHIGHLIGHT is non-nil, do not rehighlight buffers.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
(defun ediff-recenter (&optional no-rehighlight)
  "Bring the highlighted region of all buffers being compared into view.
Reestablish the default window display.

If optional NO-REHIGHLIGHT is non-nil, do not rehighlight
buffers."
  (interactive)
  (ediff-barf-if-not-control-buffer)
  (let (buffer-read-only)
    (if (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)
		 (ediff-buffer-live-p ediff-ancestor-buffer)))
	(ediff-setup-windows
	 ediff-buffer-A ediff-buffer-B ediff-buffer-C ediff-control-buffer)
      (or (eq this-command 'ediff-quit)
	  (message ediff-KILLED-VITAL-BUFFER
		   (beep 1)))
      ))

  ;; set visibility range appropriate to this invocation of Ediff.
  (ediff-visible-region)
  ;; raise
  (if (and (ediff-window-display-p)
	   (symbolp this-command)
	   (symbolp last-command)
	   ;; Either one of the display-changing commands
	   (or (memq this-command
		     '(ediff-recenter
		       ediff-dir-action ediff-registry-action
		       ediff-patch-action
		       ediff-toggle-wide-display ediff-toggle-multiframe))
	       ;; Or one of the movement cmds and prev cmd was an Ediff cmd
	       ;; This avoids raising frames unnecessarily.
	       (and (memq this-command
			  '(ediff-next-difference
			    ediff-previous-difference
			    ediff-jump-to-difference
			    ediff-jump-to-difference-at-point))
		    (not (string-match "^ediff-" (symbol-name last-command)))
		    )))
      (progn
	(if (window-live-p ediff-window-A)
	    (raise-frame (window-frame ediff-window-A)))
	(if (window-live-p ediff-window-B)
	    (raise-frame (window-frame ediff-window-B)))
	(if (window-live-p ediff-window-C)
	    (raise-frame (window-frame ediff-window-C)))))
  (if (and (ediff-window-display-p)
	   (frame-live-p ediff-control-frame)
	   (not ediff-use-long-help-message)
	   (not (ediff-frame-iconified-p ediff-control-frame)))
      (if (fboundp 'select-frame-set-input-focus)
	  (select-frame-set-input-focus ediff-control-frame)
	(raise-frame ediff-control-frame)
	(select-frame ediff-control-frame)))

  ;; Redisplay whatever buffers are showing, if there is a selected difference
  (let ((control-frame ediff-control-frame)
	(control-buf ediff-control-buffer))
    (if (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)))
	(progn
	  (or no-rehighlight
	      (ediff-select-difference ediff-current-difference))

	  (ediff-recenter-one-window 'A)
	  (ediff-recenter-one-window 'B)
	  (if ediff-3way-job
	      (ediff-recenter-one-window 'C))

	  (ediff-with-current-buffer control-buf
	    (ediff-recenter-ancestor) ; check if ancestor is alive

	    (if (and (ediff-multiframe-setup-p)
		     (not ediff-use-long-help-message)
		     (not (ediff-frame-iconified-p ediff-control-frame)))
		;; never grab mouse on quit in this place
		(ediff-reset-mouse
		 control-frame
		 (eq this-command 'ediff-quit))))
	  ))

    (or no-rehighlight
	(ediff-restore-highlighting))
    (ediff-with-current-buffer control-buf (ediff-refresh-mode-lines))
    ))