Emacs Lisp: string-to-file-force function writes string to file forcefully

Emacs Lisp: string-to-file-force function writes string to file forcefully

I often need to write strings to file, and without looking if the file exists or not, this handy function is doing exactly that.

(defun string-to-file-force (string file)
  "Prints string into file, matters not if file exists."
    (with-temp-buffer
      (insert string)
      (write-region (point-min) (point-max) file nil nil nil nil)))

Related pages

Leave Your Comment or Contact GNU.Support

Contact GNU.Support now. There is a simple rule at GNU.Support: if we can help you, we do, whenever and wherever necessary, and it's the way we've been doing business since 2002, and the only way we know


Full name:


E-mail:


Message: