diff options
| author | Sam Steingold | 2008-06-05 15:53:05 +0000 |
|---|---|---|
| committer | Sam Steingold | 2008-06-05 15:53:05 +0000 |
| commit | f0fbfd437240f5e12e03ae22ece316f504dbf477 (patch) | |
| tree | 684a4bb66ed445d3043973d242d4b6d1679e26b8 | |
| parent | d346bf7e6a987a3a8c51856aa7732d0da9a6ca95 (diff) | |
| download | emacs-f0fbfd437240f5e12e03ae22ece316f504dbf477.tar.gz emacs-f0fbfd437240f5e12e03ae22ece316f504dbf477.zip | |
(vc-update): Use `save-some-buffers' instead of signaling an error on modified buffers.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vc.el | 26 |
2 files changed, 19 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2f889f6ac53..7bf256ca69d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-06-05 Sam Steingold <sds@gnu.org> | ||
| 2 | |||
| 3 | * vc.el (vc-update): Use `save-some-buffers' instead of signaling | ||
| 4 | an error on modified buffers. | ||
| 5 | |||
| 1 | 2008-06-05 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2008-06-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * progmodes/etags.el (tags-verify-table): Be careful to use and update | 8 | * progmodes/etags.el (tags-verify-table): Be careful to use and update |
diff --git a/lisp/vc.el b/lisp/vc.el index b39c8e31c6b..d334d0e081b 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -375,7 +375,7 @@ | |||
| 375 | ;; | 375 | ;; |
| 376 | ;; Return a string containing all log entries that were made for FILE. | 376 | ;; Return a string containing all log entries that were made for FILE. |
| 377 | ;; This is used for transferring a file from one backend to another, | 377 | ;; This is used for transferring a file from one backend to another, |
| 378 | ;; retaining comment information. | 378 | ;; retaining comment information. |
| 379 | ;; | 379 | ;; |
| 380 | ;; - update-changelog (files) | 380 | ;; - update-changelog (files) |
| 381 | ;; | 381 | ;; |
| @@ -562,7 +562,7 @@ | |||
| 562 | ;; update/merge on a file basis, but on a whole repository basis. | 562 | ;; update/merge on a file basis, but on a whole repository basis. |
| 563 | ;; vc-update and vc-merge assume the arguments are always files, | 563 | ;; vc-update and vc-merge assume the arguments are always files, |
| 564 | ;; they don't deal with directories. Make sure the *vc-dir* buffer | 564 | ;; they don't deal with directories. Make sure the *vc-dir* buffer |
| 565 | ;; is updated after these operations. | 565 | ;; is updated after these operations. |
| 566 | ;; At least bzr, git and hg should benefit from this. | 566 | ;; At least bzr, git and hg should benefit from this. |
| 567 | ;; | 567 | ;; |
| 568 | ;;;; Improved branch and tag handling: | 568 | ;;;; Improved branch and tag handling: |
| @@ -571,8 +571,8 @@ | |||
| 571 | ;; display the branch name in the mode-line. Replace | 571 | ;; display the branch name in the mode-line. Replace |
| 572 | ;; vc-cvs-sticky-tag with that. | 572 | ;; vc-cvs-sticky-tag with that. |
| 573 | ;; | 573 | ;; |
| 574 | ;; - C-x v b does switch to a different backend, but the mode line is not | 574 | ;; - C-x v b does switch to a different backend, but the mode line is not |
| 575 | ;; adapted accordingly. Also, it considers RCS and CVS to be the same, | 575 | ;; adapted accordingly. Also, it considers RCS and CVS to be the same, |
| 576 | ;; which is pretty confusing. | 576 | ;; which is pretty confusing. |
| 577 | ;; | 577 | ;; |
| 578 | ;; - vc-create-tag and vc-retrieve-tag should update the | 578 | ;; - vc-create-tag and vc-retrieve-tag should update the |
| @@ -1255,7 +1255,7 @@ merge in the changes into your working copy." | |||
| 1255 | (when (not (equal buffer-file-name file)) | 1255 | (when (not (equal buffer-file-name file)) |
| 1256 | (find-file-other-window file)) | 1256 | (find-file-other-window file)) |
| 1257 | (if (save-window-excursion | 1257 | (if (save-window-excursion |
| 1258 | (vc-diff-internal nil | 1258 | (vc-diff-internal nil |
| 1259 | (cons (car vc-fileset) (cons (cadr vc-fileset) (list file))) | 1259 | (cons (car vc-fileset) (cons (cadr vc-fileset) (list file))) |
| 1260 | (vc-working-revision file) nil) | 1260 | (vc-working-revision file) nil) |
| 1261 | (goto-char (point-min)) | 1261 | (goto-char (point-min)) |
| @@ -1844,11 +1844,11 @@ See Info node `Merging'." | |||
| 1844 | 1844 | ||
| 1845 | (defun vc-default-status-extra-headers (backend dir) | 1845 | (defun vc-default-status-extra-headers (backend dir) |
| 1846 | ;; Be loud by default to remind people to add code to display | 1846 | ;; Be loud by default to remind people to add code to display |
| 1847 | ;; backend specific headers. | 1847 | ;; backend specific headers. |
| 1848 | ;; XXX: change this to return nil before the release. | 1848 | ;; XXX: change this to return nil before the release. |
| 1849 | (concat | 1849 | (concat |
| 1850 | (propertize "Extra : " 'face 'font-lock-type-face) | 1850 | (propertize "Extra : " 'face 'font-lock-type-face) |
| 1851 | (propertize "Please add backend specific headers here. It's easy!" | 1851 | (propertize "Please add backend specific headers here. It's easy!" |
| 1852 | 'face 'font-lock-warning-face))) | 1852 | 'face 'font-lock-warning-face))) |
| 1853 | 1853 | ||
| 1854 | (defun vc-dir-headers (backend dir) | 1854 | (defun vc-dir-headers (backend dir) |
| @@ -2027,7 +2027,7 @@ outside of VC) and one wants to do some operation on it." | |||
| 2027 | 2027 | ||
| 2028 | (defun vc-make-backend-object (file-or-dir) | 2028 | (defun vc-make-backend-object (file-or-dir) |
| 2029 | "Create the backend capability object needed by vc-dispatcher." | 2029 | "Create the backend capability object needed by vc-dispatcher." |
| 2030 | (vc-create-client-object | 2030 | (vc-create-client-object |
| 2031 | "VC dir" | 2031 | "VC dir" |
| 2032 | (vc-dir-headers vc-dir-backend file-or-dir) | 2032 | (vc-dir-headers vc-dir-backend file-or-dir) |
| 2033 | #'vc-generic-status-printer | 2033 | #'vc-generic-status-printer |
| @@ -2061,7 +2061,7 @@ outside of VC) and one wants to do some operation on it." | |||
| 2061 | ;(define-key map "A" 'vc-annotate) ;; g is taken by dispatcher refresh | 2061 | ;(define-key map "A" 'vc-annotate) ;; g is taken by dispatcher refresh |
| 2062 | (define-key map "x" 'vc-dir-hide-up-to-date)) | 2062 | (define-key map "x" 'vc-dir-hide-up-to-date)) |
| 2063 | ) | 2063 | ) |
| 2064 | ;; FIXME: Needs to alter a buffer-local map, otherwise clients may clash | 2064 | ;; FIXME: Needs to alter a buffer-local map, otherwise clients may clash |
| 2065 | (let ((map vc-dir-menu-map)) | 2065 | (let ((map vc-dir-menu-map)) |
| 2066 | ;; VC info details | 2066 | ;; VC info details |
| 2067 | (define-key map [sepvcdet] '("--")) | 2067 | (define-key map [sepvcdet] '("--")) |
| @@ -2284,10 +2284,12 @@ changes from the current branch are merged into the working file." | |||
| 2284 | (let* ((vc-fileset (vc-deduce-fileset)) | 2284 | (let* ((vc-fileset (vc-deduce-fileset)) |
| 2285 | (backend (car vc-fileset)) | 2285 | (backend (car vc-fileset)) |
| 2286 | (files (cadr vc-fileset))) | 2286 | (files (cadr vc-fileset))) |
| 2287 | (save-some-buffers ; save buffers visiting files | ||
| 2288 | nil (lambda () | ||
| 2289 | (and (buffer-modified-p) | ||
| 2290 | (let ((file (buffer-file-name))) | ||
| 2291 | (and file (member file files)))))) | ||
| 2287 | (dolist (file files) | 2292 | (dolist (file files) |
| 2288 | (when (let ((buf (get-file-buffer file))) | ||
| 2289 | (and buf (buffer-modified-p buf))) | ||
| 2290 | (error "Please kill or save all modified buffers before updating.")) | ||
| 2291 | (if (vc-up-to-date-p file) | 2293 | (if (vc-up-to-date-p file) |
| 2292 | (vc-checkout file nil t) | 2294 | (vc-checkout file nil t) |
| 2293 | (if (eq (vc-checkout-model backend (list file)) 'locking) | 2295 | (if (eq (vc-checkout-model backend (list file)) 'locking) |