Function: ediff-scroll-horizontally

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

Signature

(ediff-scroll-horizontally &optional ARG)

Documentation

Horizontally scroll buffers A, B (and C if appropriate).

With prefix argument ARG, scroll that many columns, else nearly the width of the A/B/C windows.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
(defun ediff-scroll-horizontally (&optional arg)
  "Horizontally scroll buffers A, B (and C if appropriate).
With prefix argument ARG, scroll that many columns, else nearly
the width of the A/B/C windows."
  (interactive "P")
  (ediff-barf-if-not-control-buffer)

  ;; 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))

  (ediff-operate-on-windows
   ;; Arrange for scroll-left and scroll-right being called
   ;; interactively so that they set the window's min_hscroll.
   ;; Otherwise, automatic hscrolling will undo the effect of
   ;; hscrolling.
   (if (= last-command-event ?<)
       (lambda (arg)
	 (let ((current-prefix-arg arg))
	   (call-interactively #'scroll-left)))
     (lambda (arg)
       (let ((current-prefix-arg arg))
	 (call-interactively #'scroll-right))))
   ;; calculate argument to scroll-left/right
   ;; if there is an explicit argument
   (if (and arg (not (equal arg '-)))
       ;; use it
       (prefix-numeric-value arg)
     ;; if not, see if we can determine a default amount
     ;; (half the window width)
     (if (null ediff-control-window)
	 ;; no control window, use nil
	 nil
       (let ((default-amount
	       (- (/ (min (window-width ediff-window-A)
			  (window-width ediff-window-B)
			  (if ediff-3way-comparison-job
			      (window-width ediff-window-C)
			    500) ; some large number
                          (if (and ediff-merge-with-ancestor-job
                                   ediff-show-ancestor)
                              (window-height ediff-window-Ancestor)
                            500)) ; some large number
		     2)
		  3)))
	 ;; window found
	 (if arg
	     ;; C-u as argument means half of default amount
	     (/ default-amount 2)
	   ;; no argument means default amount
	   default-amount))))))