* Show unsaved changes (as diff)
@ 2007-09-23 14:29 Florian Lorenzen
2007-09-23 14:39 ` David Kastrup
0 siblings, 1 reply; 5+ messages in thread
From: Florian Lorenzen @ 2007-09-23 14:29 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1.1: Type: text/plain, Size: 704 bytes --]
Hello,
I have a very innocent question, I'm sorry that I could not figure out
the answer myself: is there a quick way to ask Emacs to show the
unsaved changes in a file's buffer as a diff? Sometimes, I attempt to
kill a bufer and Emacs asks me if I want do discard the changes. As my
memory is very weak sometimes, I cannot recall what I had changed and
if this was important in any way. So, I'd simply like to see what I'd
throw away. Of course, I can copy the file's buffer's content to a new
buffer, revert the file's buffer and make a diff on these two. But is
there something ready-made for this kind of situation, like M-x
show-unsaved-changes?
Thanks for any suggestions, best regards,
Florian
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Show unsaved changes (as diff)
2007-09-23 14:29 Show unsaved changes (as diff) Florian Lorenzen
@ 2007-09-23 14:39 ` David Kastrup
2007-09-24 17:44 ` Martin Fischer
0 siblings, 1 reply; 5+ messages in thread
From: David Kastrup @ 2007-09-23 14:39 UTC (permalink / raw)
To: help-gnu-emacs
Florian Lorenzen <lorenzen@physik.fu-berlin.de> writes:
> Hello,
>
> I have a very innocent question, I'm sorry that I could not figure out
> the answer myself: is there a quick way to ask Emacs to show the
> unsaved changes in a file's buffer as a diff? Sometimes, I attempt to
> kill a bufer and Emacs asks me if I want do discard the changes. As my
> memory is very weak sometimes, I cannot recall what I had changed and
> if this was important in any way. So, I'd simply like to see what I'd
> throw away. Of course, I can copy the file's buffer's content to a new
> buffer, revert the file's buffer and make a diff on these two. But is
> there something ready-made for this kind of situation, like M-x
> show-unsaved-changes?
M-x diff-buffer-with-file RET
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Show unsaved changes (as diff)
2007-09-23 14:39 ` David Kastrup
@ 2007-09-24 17:44 ` Martin Fischer
2007-09-25 5:54 ` Gordon Beaton
2007-09-25 7:14 ` Thierry Volpiatto
0 siblings, 2 replies; 5+ messages in thread
From: Martin Fischer @ 2007-09-24 17:44 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> David Kastrup writes:
> Date: Sun, 23 Sep 2007 16:39:59 +0200
>
> Florian Lorenzen writes:
>
>> Hello,
>>
>> I have a very innocent question, I'm sorry that I could not figure out
>> the answer myself: is there a quick way to ask Emacs to show the
>> unsaved changes in a file's buffer as a diff? Sometimes, I attempt to
>> kill a bufer and Emacs asks me if I want do discard the changes. As my
>> memory is very weak sometimes, I cannot recall what I had changed and
>> if this was important in any way. So, I'd simply like to see what I'd
>> throw away. Of course, I can copy the file's buffer's content to a new
>> buffer, revert the file's buffer and make a diff on these two. But is
>> there something ready-made for this kind of situation, like M-x
>> show-unsaved-changes?
>
> M-x diff-buffer-with-file RET
>
> --
> David Kastrup, Kriemhildstr. 15, 44793 Bochum
>
Hi,
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) ?
Thank you
Martin
--
parozusa at web dot de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Show unsaved changes (as diff)
2007-09-24 17:44 ` Martin Fischer
@ 2007-09-25 5:54 ` Gordon Beaton
2007-09-25 7:14 ` Thierry Volpiatto
1 sibling, 0 replies; 5+ messages in thread
From: Gordon Beaton @ 2007-09-25 5:54 UTC (permalink / raw)
To: help-gnu-emacs
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
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Show unsaved changes (as diff)
2007-09-24 17:44 ` Martin Fischer
2007-09-25 5:54 ` Gordon Beaton
@ 2007-09-25 7:14 ` Thierry Volpiatto
1 sibling, 0 replies; 5+ messages in thread
From: Thierry Volpiatto @ 2007-09-25 7:14 UTC (permalink / raw)
To: help-gnu-emacs
The following message is a courtesy copy of an article
that has been posted to gnu.emacs.help as well.
>>>>> "Martin" == Martin Fischer <nospam@nospam.net> writes:
>>>>>> David Kastrup writes:
>> Date: Sun, 23 Sep 2007 16:39:59 +0200
>>
>> Florian Lorenzen writes:
>>
>>> Hello,
>>>
>>> I have a very innocent question, I'm sorry that I could not
>>> figure out the answer myself: is there a quick way to ask Emacs
>>> to show the unsaved changes in a file's buffer as a diff?
>>> Sometimes, I attempt to kill a bufer and Emacs asks me if I want
>>> do discard the changes. As my memory is very weak sometimes, I
>>> cannot recall what I had changed and if this was important in
>>> any way. So, I'd simply like to see what I'd throw away. Of
>>> course, I can copy the file's buffer's content to a new buffer,
>>> revert the file's buffer and make a diff on these two. But is
>>> there something ready-made for this kind of situation, like M-x
>>> show-unsaved-changes?
>>
>> M-x diff-buffer-with-file RET
>>
>> -- David Kastrup, Kriemhildstr. 15, 44793 Bochum
>>
Hi,
Martin> by the way, is it possible to use this in some way with the
Martin> more "readable" representation of ediff and how could it be
Martin> done (moderate lisp knowledge) ?
Thierry> Hello, you can use C-x s instead of C-x C-s you will have a
Thierry> prompt for d (diff) s q etc.. (only with emacs >=22)
--
A + Thierry
pubkey: http://pgp.mit.edu/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-09-25 7:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-23 14:29 Show unsaved changes (as diff) Florian Lorenzen
2007-09-23 14:39 ` David Kastrup
2007-09-24 17:44 ` Martin Fischer
2007-09-25 5:54 ` Gordon Beaton
2007-09-25 7:14 ` Thierry Volpiatto
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.