home
NOTE: Under Construction - I'm in the middle of upgrading my site and lots of stuff is kinda broken. Please forgive the mess.

Read Files Contents Into A Temporary Emacs Buffer With Lisp

October 2022

This started as an example way to read file contents. It's also the code that is setup to use END in a file.

This reads a file into a temporary buffer, deletes everything up to the first occurance of the word `brown`, and then outputs what's left.

Code
(with-temp-buffer
 (insert-file-contents "input.txt")
 (goto-char (point-max))
 (delete-region
  (point-min) 
  (search-forward "__END__" nil nil -1))
 (delete-region
  (point-min) 
  (search-forward "__END__\n" nil nil))
 (append-to-file nil nil "output.txt"))
═══ § ═══