[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Show unsaved changes (as diff)
From: |
Gordon Beaton |
Subject: |
Re: Show unsaved changes (as diff) |
Date: |
25 Sep 2007 05:54:11 GMT |
User-agent: |
slrn/0.9.8.1pl1 (Linux) |
On Mon, 24 Sep 2007 18:44:58 +0100, Martin Fischer wrote:
> by the way, is it possible to use this in some way with the more
> "readable" representation of ediff and how could it be done
> (moderate lisp knowledge) ?
Not ediff, but I use this:
(defun tkdiff-buffer-with-file ()
"Use tkdiff to compare the current buffer with the disk file contents."
(interactive)
(if (and (buffer-file-name)
(file-exists-p (buffer-file-name)))
(let ((temp-file (make-temp-file
(concat "/tmp/buffer-" (file-name-nondirectory
(buffer-file-name)) "-"))))
(save-restriction
(widen)
(write-region (point-min) (point-max) temp-file nil 'nomessage)
(set-process-sentinel
(start-process "tkdiff" nil "tkdiff" (buffer-file-name) temp-file)
`(lambda (process event)
(if (file-exists-p ,temp-file) (delete-file ,temp-file))))))
(message "Current buffer is not associated with any existing file")))
/gordon
--