Function: term-check-source

term-check-source is a byte-compiled function defined in term.el.gz.

Signature

(term-check-source FNAME)

Source Code

;; Defined in /usr/src/emacs/lisp/term.el.gz
;; (TERM-CHECK-SOURCE 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.

(defun term-check-source (fname)
  (let ((buff (get-file-buffer fname)))
    (when (and buff
	       (buffer-modified-p buff)
	       (y-or-n-p (format "Save buffer %s first? "
				 (buffer-name buff))))
      ;; save BUFF.
      (with-current-buffer buff
	(save-buffer)))))