I have the following code, which opens a file, inserts some text, saves the file and closes it.
(defun batch (file)
(find-file file)
(end-of-buffer)
(insert "nix")
(save-buffer)
(kill-buffer))
If the file is already visited the buffer gets closed. How to prevent that? How to keep the buffer, if find-file
does not created a new buffer? How to know, if a file has already been opened in a buffer?