Function: comint-check-source
comint-check-source is a byte-compiled function defined in
comint.el.gz.
Signature
(comint-check-source FNAME)
Documentation
Check whether to save buffers visiting file FNAME.
Prior to loading or compiling (or otherwise processing) a file (in the CMU process-in-a-buffer modes), this function can be called on the filename. If the file is loaded into a buffer, and the buffer is modified, the user is queried to see if he wants to save the buffer before proceeding with the load or compile.
Source Code
;; Defined in /usr/src/emacs/lisp/comint.el.gz
(defun comint-check-source (fname)
"Check whether to save buffers visiting file FNAME.
Prior to loading or compiling (or otherwise processing) a file (in the CMU
process-in-a-buffer modes), this function can be called on the filename.
If the file is loaded into a buffer, and the buffer is modified, the user
is queried to see if he wants to save the buffer before proceeding with
the load or compile."
(let ((buff (get-file-buffer fname)))
(if (and buff
(buffer-modified-p buff)
(y-or-n-p (format "Save buffer %s first? " (buffer-name buff))))
(with-current-buffer buff
(save-buffer)))))