aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/files.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el30
1 files changed, 18 insertions, 12 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 31d2b8762fa..020249dbf23 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2999,18 +2999,24 @@ After saving the buffer, this function runs `after-save-hook'."
2999This requires the external program `diff' to be in your `exec-path'." 2999This requires the external program `diff' to be in your `exec-path'."
3000 (interactive "bBuffer: ") 3000 (interactive "bBuffer: ")
3001 (with-current-buffer (get-buffer (or buffer (current-buffer))) 3001 (with-current-buffer (get-buffer (or buffer (current-buffer)))
3002 (if (null buffer-file-name) 3002 (if (and buffer-file-name
3003 (message "Buffer %s has no associated file" (buffer-name)) 3003 (file-exists-p buffer-file-name))
3004 (let ((tempfile (make-temp-file "buffer-content-"))) 3004 (let ((tempfile (make-temp-file "buffer-content-")))
3005 (unwind-protect 3005 (unwind-protect
3006 (save-restriction 3006 (save-restriction
3007 (widen) 3007 (widen)
3008 (write-region (point-min) (point-max) tempfile nil 'nomessage) 3008 (write-region (point-min) (point-max) tempfile nil 'nomessage)
3009 (diff buffer-file-name tempfile nil t) 3009 (diff buffer-file-name tempfile nil t)
3010 (sit-for 0)) 3010 (sit-for 0))
3011 (when (file-exists-p tempfile) 3011 (when (file-exists-p tempfile)
3012 (delete-file tempfile))) 3012 (delete-file tempfile))))
3013 nil)))) 3013 (message "Buffer %s has no associated file on disc" (buffer-name))
3014 ;; Display that message for 1 second so that user can read it
3015 ;; in the minibuffer.
3016 (sit-for 1)))
3017 ;; return always nil, so that save-buffers-kill-emacs will not move
3018 ;; over to the next unsaved buffer when calling `d'.
3019 nil)
3014 3020
3015(defvar save-some-buffers-action-alist 3021(defvar save-some-buffers-action-alist
3016 '((?\C-r 3022 '((?\C-r