aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Gutov2015-11-26 17:15:28 +0200
committerDmitry Gutov2015-11-26 17:15:43 +0200
commit02cd9cb8afd9510e3bdb20ce7148d1b9a6aa9d12 (patch)
tree7372f67964e4be0caebf6f825ea365f4072176ce /lisp
parent5d93a89e805baa2f29941fd801e48235f6c1a6b6 (diff)
downloademacs-02cd9cb8afd9510e3bdb20ce7148d1b9a6aa9d12.tar.gz
emacs-02cd9cb8afd9510e3bdb20ce7148d1b9a6aa9d12.zip
Check if the file exists on disk before producing the revert diff
* lisp/vc/vc-dispatcher.el (vc-buffer-sync): Check if the file exists on disk (bug#20558).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/vc/vc-dispatcher.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index ec55867fcfe..b8593e30a54 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -580,12 +580,20 @@ editing!"
580(defun vc-buffer-sync (&optional not-urgent) 580(defun vc-buffer-sync (&optional not-urgent)
581 "Make sure the current buffer and its working file are in sync. 581 "Make sure the current buffer and its working file are in sync.
582NOT-URGENT means it is ok to continue if the user says not to save." 582NOT-URGENT means it is ok to continue if the user says not to save."
583 (when (buffer-modified-p) 583 (let (missing)
584 (if (or vc-suppress-confirm 584 (when (cond
585 (y-or-n-p (format "Buffer %s modified; save it? " (buffer-name)))) 585 ((buffer-modified-p))
586 (save-buffer) 586 ((not (file-exists-p buffer-file-name))
587 (unless not-urgent 587 (setq missing t)))
588 (error "Aborted"))))) 588 (if (or vc-suppress-confirm
589 (y-or-n-p (format "Buffer %s %s; save it? "
590 (buffer-name)
591 (if missing
592 "is missing on disk"
593 "modified"))))
594 (save-buffer)
595 (unless not-urgent
596 (error "Aborted"))))))
589 597
590;; Command closures 598;; Command closures
591 599