diff options
| author | Markus Rost | 2002-09-13 20:22:29 +0000 |
|---|---|---|
| committer | Markus Rost | 2002-09-13 20:22:29 +0000 |
| commit | 4e4e95198a1513ea23b45f2b747fcecaaf4fa06a (patch) | |
| tree | 5dca58dc02e43aaaa93100fe795c87ff800a1e87 | |
| parent | 3baada38f8047e7821979b961a07e02659cedf99 (diff) | |
| download | emacs-4e4e95198a1513ea23b45f2b747fcecaaf4fa06a.tar.gz emacs-4e4e95198a1513ea23b45f2b747fcecaaf4fa06a.zip | |
(diff-buffer-with-file): Check whether associated file exists.
Display message for 1 second. Always return nil.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/files.el | 30 |
2 files changed, 25 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c56b9536f90..ccda6c1344e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2002-09-13 Markus Rost <rost@math.ohio-state.edu> | ||
| 2 | |||
| 3 | * files.el (diff-buffer-with-file): Check whether associated file | ||
| 4 | exists. Display message for 1 second. Always return nil. | ||
| 5 | |||
| 1 | 2002-09-13 Stefan Monnier <monnier@cs.yale.edu> | 6 | 2002-09-13 Stefan Monnier <monnier@cs.yale.edu> |
| 2 | 7 | ||
| 3 | * derived.el (define-derived-mode): Properly ignore unknown args. | 8 | * derived.el (define-derived-mode): Properly ignore unknown args. |
| @@ -81,8 +86,8 @@ | |||
| 81 | 86 | ||
| 82 | 2002-09-11 Vinicius Jose Latorre <vinicius@cpqd.com.br> | 87 | 2002-09-11 Vinicius Jose Latorre <vinicius@cpqd.com.br> |
| 83 | 88 | ||
| 84 | * ps-print.el: Adjust ps-print-color-p, ps-default-fg and ps-default-bg | 89 | * ps-print.el: Adjust ps-print-color-p, ps-default-fg and |
| 85 | setting. | 90 | ps-default-bg setting. |
| 86 | (ps-print-version): New version number (6.5.7). | 91 | (ps-print-version): New version number (6.5.7). |
| 87 | (ps-mark-active-p): New fun. | 92 | (ps-mark-active-p): New fun. |
| 88 | (ps-print-preprint-region): Adjust code. | 93 | (ps-print-preprint-region): Adjust code. |
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'." | |||
| 2999 | This requires the external program `diff' to be in your `exec-path'." | 2999 | This 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 |