Function: viper-save-string-in-file

viper-save-string-in-file is a byte-compiled function defined in viper-util.el.gz.

Signature

(viper-save-string-in-file STRING FILE &optional PATTERN)

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-util.el.gz
;; Save STRING in FILE.  If PATTERN is non-nil, remove strings that
;; match this pattern.
(defun viper-save-string-in-file (string file &optional pattern)
  (let ((buf (find-file-noselect (substitute-in-file-name file))))
    (with-current-buffer buf
      (let ((inhibit-read-only t))
	(goto-char (point-min))
	(if pattern (delete-matching-lines pattern))
	(goto-char (point-max))
	(if string (insert string))
	(save-buffer)))
    (kill-buffer buf)
    ))