Function: append-to-buffer
append-to-buffer is an interactive and byte-compiled function defined
in simple.el.gz.
Signature
(append-to-buffer BUFFER START END)
Documentation
Append to specified BUFFER the text of the region.
The text is inserted into that buffer before its point. BUFFER can be a buffer or the name of a buffer; this function will create BUFFER if it doesn't already exist.
When calling from a program, give three arguments: BUFFER (or buffer name), START and END. START and END specify the portion of the current buffer to be copied.
Probably introduced at or before Emacs version 19.20.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun append-to-buffer (buffer start end)
"Append to specified BUFFER the text of the region.
The text is inserted into that buffer before its point.
BUFFER can be a buffer or the name of a buffer; this
function will create BUFFER if it doesn't already exist.
When calling from a program, give three arguments:
BUFFER (or buffer name), START and END.
START and END specify the portion of the current buffer to be copied."
(interactive
(list (read-buffer "Append to buffer: " (other-buffer (current-buffer) t))
(region-beginning) (region-end)))
(let* ((oldbuf (current-buffer))
(append-to (get-buffer-create buffer))
(windows (get-buffer-window-list append-to t t))
point)
(save-excursion
(with-current-buffer append-to
(setq point (point))
(barf-if-buffer-read-only)
(insert-buffer-substring oldbuf start end)
(dolist (window windows)
(when (= (window-point window) point)
(set-window-point window (point))))))))