Function: 2C-toggle-autoscroll

2C-toggle-autoscroll is an interactive and byte-compiled function defined in two-column.el.gz.

Signature

(2C-toggle-autoscroll ARG)

Documentation

Toggle autoscrolling.

With prefix argument ARG, turn on autoscrolling if ARG is positive, otherwise turn it off. When autoscrolling is turned on, this also realigns the two buffers.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/two-column.el.gz
(defun 2C-toggle-autoscroll (arg)
  "Toggle autoscrolling.
With prefix argument ARG, turn on autoscrolling if ARG is
positive, otherwise turn it off.  When autoscrolling is turned
on, this also realigns the two buffers."
  (interactive "P")
  ;(sit-for 0)
  (setq 2C-autoscroll-start (window-start))
  (if (setq 2C-autoscroll (if arg
			      (>= (prefix-numeric-value arg) 0)
			    (not 2C-autoscroll)))
      (select-window
       (prog1 (selected-window)
	 (message "Autoscrolling is on.")
	 (setq arg (count-lines (point-min) (window-start)))
	 (if (get-buffer-window (2C-other t))
	     (progn
	       (select-window (get-buffer-window (2C-other)))
	       (setq arg (- arg (count-lines (point-min) (window-start))))
	       ;; make sure that other buffer has enough lines
	       (save-excursion
		 (insert-char ?\n
			      (- arg (count-lines (window-start)
						  (goto-char (point-max)))
				 -1)))
	       (scroll-up arg)))))
    (message "Autoscrolling is off.")))