]> gitweb.michael.orlitzky.com - emacs.d.git/blob - diff-buffer-against-file.el
mode-hooks.el: add dns-mode hooks
[emacs.d.git] / diff-buffer-against-file.el
1 (defun diff-buffer-against-file (context)
2 "diff the current (edited) buffer against the file of the same name"
3 (interactive "P")
4 (let (($file (concat "\"" buffer-file-name "\""))
5 ($temp_buffer "emacs.diff")
6 ($temp_file "/tmp/emacs.diff"))
7
8 (delete-other-windows)
9 (push-mark (point) t)
10 (generate-new-buffer $temp_file)
11 (copy-to-buffer $temp_buffer (point-min) (point-max))
12 (set-buffer $temp_buffer)
13 (write-file $temp_file)
14 (shell-command (concat (if context "diff -c " "diff ") $file " " $temp_file))
15 (kill-buffer $temp_file)
16 (pop-mark)
17 )
18 )