minibuffer

How to write buffer region into a file in Emacs Lisp?

September 17, 2023
(write-region (point-at-bol) (point-at-eol) "foo.txt")
(write-region nil nil "foo.txt")
(write-region nil nil "foo.txt" t)
(write-region "foo" nil "foo.txt")

(progn
  (make-directory "foo/bar" t)
  (write-region nil nil "foo/bar/baz.txt"))