aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc/diff.el
diff options
context:
space:
mode:
authorBob Rogers2010-11-22 12:57:46 -0500
committerStefan Monnier2010-11-22 12:57:46 -0500
commit6a7662bb7d5f9c1905d2177ecf5cf0a0e0f76204 (patch)
tree32d91ccf0aa4d58ba2ced36a00d4b7610afdc99e /lisp/vc/diff.el
parent440b1345f63d5ce7e3924a20779e259e75c6c776 (diff)
downloademacs-6a7662bb7d5f9c1905d2177ecf5cf0a0e0f76204.tar.gz
emacs-6a7662bb7d5f9c1905d2177ecf5cf0a0e0f76204.zip
* lisp/files.el: Make revert work with diff-buffer-with-file.
(diff-buffer-internal): New function extracted from diff-buffer-with-file (diff-buffer-with-file): Use it. * lisp/vc/diff.el (diff-into-buffer): New fun, extracted from diff. (diff): Use it. Fixes: debbugs:7277
Diffstat (limited to 'lisp/vc/diff.el')
-rw-r--r--lisp/vc/diff.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index e79e72c8b0d..1a835b59994 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -108,11 +108,16 @@ specified in `diff-switches' are passed to the diff command."
108 (read-file-name "Diff original file: " 108 (read-file-name "Diff original file: "
109 (file-name-directory newf) nil t))) 109 (file-name-directory newf) nil t)))
110 (list oldf newf (diff-switches)))) 110 (list oldf newf (diff-switches))))
111 (diff-into-buffer nil old new switches no-async))
112
113(defun diff-into-buffer (buf old new &optional switches no-async)
114 ;; Noninteractive helper for creating and reverting diff buffers.
111 (setq new (expand-file-name new) 115 (setq new (expand-file-name new)
112 old (expand-file-name old)) 116 old (expand-file-name old))
113 (or switches (setq switches diff-switches)) ; If not specified, use default. 117 (or switches (setq switches diff-switches)) ; If not specified, use default.
118 (or buf (setq buf (get-buffer-create "*Diff*")))
114 (let* ((old-alt (file-local-copy old)) 119 (let* ((old-alt (file-local-copy old))
115 (new-alt (file-local-copy new)) 120 (new-alt (file-local-copy new))
116 (command 121 (command
117 (mapconcat 'identity 122 (mapconcat 'identity
118 `(,diff-command 123 `(,diff-command
@@ -123,7 +128,6 @@ specified in `diff-switches' are passed to the diff command."
123 ,(shell-quote-argument (or old-alt old)) 128 ,(shell-quote-argument (or old-alt old))
124 ,(shell-quote-argument (or new-alt new))) 129 ,(shell-quote-argument (or new-alt new)))
125 " ")) 130 " "))
126 (buf (get-buffer-create "*Diff*"))
127 (thisdir default-directory) 131 (thisdir default-directory)
128 proc) 132 proc)
129 (save-excursion 133 (save-excursion