I need to copy part of the file (with re-search-forward
) to another file under the marker. I know how to use re-search-forward
, but I have problems with buffer.
Am i right with my logic?
- 1) open needed file with temp buffer
- 2) create new buffer
- 3) find needed lines with
re-search-forward
and copy them in this new buffer - 4) insert lines into opened file with
insert-buffer-substring
Right now i have a function like this:
(defun my-insert-file-name (filename)
(interactive "*fInsert file name: ")
(save-excursion
(goto-char (point-min))
(when (re-search-forward "#here")
(forward-line 1)
(------something should be here-----)))
append-to-buffer
orappend-to-file
but I'm not entirely clear on your requirements here. – glucas May 16 '17 at 19:54