Function: 2C-two-columns

2C-two-columns is an autoloaded, interactive and byte-compiled function defined in two-column.el.gz.

Signature

(2C-two-columns &optional BUFFER)

Documentation

Split current window vertically for two-column editing.

When called the first time, associates a buffer with the current buffer in two-column minor mode (use C-h m (describe-mode) once in the mode, for details.). It runs 2C-other-buffer-hook in the new buffer. When called again, restores the screen layout with the current buffer first and the associated buffer to its right.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/two-column.el.gz
;;;###autoload
(defun 2C-two-columns (&optional buffer)
  "Split current window vertically for two-column editing.
\\<global-map>When called the first time, associates a buffer with the current
buffer in two-column minor mode (use \\[describe-mode] once in the mode,
for details.).  It runs `2C-other-buffer-hook' in the new buffer.
When called again, restores the screen layout with the current buffer
first and the associated buffer to its right."
  (interactive "P")
  ;; first go to full width, so that we can certainly split into two windows
  (unless (window-full-width-p)
    (enlarge-window 99999 t))
  (split-window-right
   (max window-min-width (min 2C-window-width
			      (- (frame-width) window-min-width))))
  (if (2C-other)
      (progn
	(other-window 1)
	(switch-to-buffer (2C-other))
	(other-window -1)
	(if 2C-autoscroll
	    (2C-toggle-autoscroll t)))

    (2C-mode (prog1 (point-marker)
	       (other-window 1)
	       (switch-to-buffer
		(or buffer
		    (generate-new-buffer (concat "2C/" (buffer-name)))))
	       (or buffer
		   (run-hooks '2C-other-buffer-hook))))

    (2C-mode (prog1 (point-marker)
	       (other-window -1)))))