* doc/lispref/text.texi (Insertion): Document it.
* lisp/subr.el (insert-into-buffer): New function.
@defun insert-buffer-substring-no-properties from-buffer-or-name &optional start end
This is like @code{insert-buffer-substring} except that it does not
copy any text properties.
+@end defun
+
+@defun insert-into-buffer to-buffer &optional start end
+This is like @code{insert-buffer-substring}, but works in the opposite
+direction: The text is copied from the current buffer into
+@var{to-buffer}. The block of text is copied to the current point in
+@var{to-buffer}, and point (in that buffer) is advanced to after the
+end of the copied text. Is @code{start}/@code{end} is @code{nil}, the
+entire text in the current buffer is copied over.
@end defun
@xref{Sticky Properties}, for other insertion functions that inherit
** Miscellaneous
++++
+*** New utility function 'insert-into-buffer'.
+This is like 'insert-into-buffer', but works in the opposite direction.
+
+++
*** New user option 'lock-file-name-transforms'.
This option allows controlling where lock files are written. It uses
(insert-buffer-substring buffer start end)
(remove-yank-excluded-properties opoint (point))))
+(defun insert-into-buffer (buffer &optional start end)
+ "Insert the contents of the current buffer into BUFFER.
+If START/END, only insert that region from the current buffer.
+Point in BUFFER will be placed after the inserted text."
+ (let ((current (current-buffer)))
+ (with-current-buffer buffer
+ (insert-buffer-substring current start end))))
+
(defun yank-handle-font-lock-face-property (face start end)
"If `font-lock-defaults' is nil, apply FACE as a `face' property.
START and END denote the start and end of the text to act on.