Mercurial > emacs
diff lisp/vc/diff.el @ 111673:a8aaa73f87fa
* 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.
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Mon, 22 Nov 2010 12:57:46 -0500 |
| parents | d928a6a7c3f2 |
| children | 7b1a21c5033e |
line wrap: on
line diff
--- a/lisp/vc/diff.el Mon Nov 22 11:33:06 2010 +0000 +++ b/lisp/vc/diff.el Mon Nov 22 12:57:46 2010 -0500 @@ -108,11 +108,16 @@ (read-file-name "Diff original file: " (file-name-directory newf) nil t))) (list oldf newf (diff-switches)))) + (diff-into-buffer nil old new switches no-async)) + +(defun diff-into-buffer (buf old new &optional switches no-async) + ;; Noninteractive helper for creating and reverting diff buffers. (setq new (expand-file-name new) old (expand-file-name old)) (or switches (setq switches diff-switches)) ; If not specified, use default. + (or buf (setq buf (get-buffer-create "*Diff*"))) (let* ((old-alt (file-local-copy old)) - (new-alt (file-local-copy new)) + (new-alt (file-local-copy new)) (command (mapconcat 'identity `(,diff-command @@ -123,7 +128,6 @@ ,(shell-quote-argument (or old-alt old)) ,(shell-quote-argument (or new-alt new))) " ")) - (buf (get-buffer-create "*Diff*")) (thisdir default-directory) proc) (save-excursion
