;;; vc-dispatcher.el -- generic command-dispatcher facility. -*- lexical-binding: t -*-
-;; Copyright (C) 2008-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2016 Free Software Foundation, Inc.
;; Author: FSF (see below for full credits)
;; Maintainer: Eric S. Raymond <esr@thyrsus.com>
(defun vc-buffer-sync (&optional not-urgent)
"Make sure the current buffer and its working file are in sync.
NOT-URGENT means it is ok to continue if the user says not to save."
- (when (buffer-modified-p)
- (if (or vc-suppress-confirm
- (y-or-n-p (format "Buffer %s modified; save it? " (buffer-name))))
- (save-buffer)
- (unless not-urgent
- (error "Aborted")))))
+ (let (missing)
+ (when (cond
+ ((buffer-modified-p))
+ ((not (file-exists-p buffer-file-name))
+ (setq missing t)))
+ (if (or vc-suppress-confirm
+ (y-or-n-p (format "Buffer %s %s; save it? "
+ (buffer-name)
+ (if missing
+ "is missing on disk"
+ "modified"))))
+ (save-buffer)
+ (unless not-urgent
+ (error "Aborted"))))))
;; Command closures
(make-local-variable 'vc-log-after-operation-hook)
(when after-hook
(setq vc-log-after-operation-hook after-hook))
- (setq vc-log-operation action)
+ (set (make-local-variable 'vc-log-operation) action)
(when comment
(erase-buffer)
(when (stringp comment) (insert comment)))
(funcall log-operation
log-fileset
log-entry))
+ (setq vc-log-operation nil)
;; Quit windows on logbuf.
(cond