Function: 2C-merge
2C-merge is an interactive and byte-compiled function defined in
two-column.el.gz.
Signature
(2C-merge)
Documentation
Merges the associated buffer with the current buffer.
They get merged at the column, which is the value of 2C-window-width,
i.e. usually at the vertical window separator. This separator gets
replaced with white space. Beyond that the value of 2C-separator gets
inserted on merged lines. The two columns are thus pasted side by side,
in a single text. If the other buffer is not displayed to the left of
this one, then this one becomes the left column.
If you want 2C-separator on empty lines in the second column,
you should put just one space in them. In the final result, you can strip
off trailing spaces with M-x delete-trailing-whitespace (delete-trailing-whitespace).
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/two-column.el.gz
;; this doesn't use yank-rectangle, so that the first column can
;; contain long lines
(defun 2C-merge ()
"Merges the associated buffer with the current buffer.
They get merged at the column, which is the value of `2C-window-width',
i.e. usually at the vertical window separator. This separator gets
replaced with white space. Beyond that the value of `2C-separator' gets
inserted on merged lines. The two columns are thus pasted side by side,
in a single text. If the other buffer is not displayed to the left of
this one, then this one becomes the left column.
If you want `2C-separator' on empty lines in the second column,
you should put just one space in them. In the final result, you can strip
off trailing spaces with \\[delete-trailing-whitespace]."
(interactive)
(and (> (car (window-edges)) 0) ; not touching left edge of screen
(eq (window-buffer (previous-window))
(2C-other t))
(other-window -1))
(save-excursion
(let ((b1 (current-buffer))
(b2 (2C-other t))
string)
(goto-char (point-min))
(set-buffer b2)
(goto-char (point-min))
(while (not (eobp))
(setq string (buffer-substring (point)
(progn (end-of-line) (point))))
(or (eobp)
(forward-char)) ; next line
(set-buffer b1)
(if (string= string "")
()
(end-of-line)
(indent-to-column 2C-window-width)
(insert 2C-separator string))
(forward-line 1) ; add one if necessary
(set-buffer b2))))
(unless (window-full-width-p)
(enlarge-window 99999 t)))