unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to create the patch from current file
@ 2009-07-15  9:22 Michal
  2009-07-15  9:40 ` Teemu Likonen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michal @ 2009-07-15  9:22 UTC (permalink / raw)
  To: help-gnu-emacs

Hallo group readers.

Imagine the following situation:
I just changed some part of file, but did not save it.
Now I want to create a patch comparing to the original file.
Do You know any emacs command that would do it for me?

Optionally I can imagine that this might even be possible after I saved
a file. Then file~ could be used as a version before changes?

best regards,
Michal


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to create the patch from current file
  2009-07-15  9:22 how to create the patch from current file Michal
@ 2009-07-15  9:40 ` Teemu Likonen
  2009-07-15  9:52   ` Pascal J. Bourguignon
  2009-07-15 15:04   ` Michal
  2009-07-15  9:46 ` Pascal J. Bourguignon
       [not found] ` <87ab36jnco.fsf@iki.fi>
  2 siblings, 2 replies; 6+ messages in thread
From: Teemu Likonen @ 2009-07-15  9:40 UTC (permalink / raw)
  To: help-gnu-emacs

On 2009-07-15 11:22 (+0200), Michal wrote:

> Imagine the following situation:
> I just changed some part of file, but did not save it.
> Now I want to create a patch comparing to the original file.
> Do You know any emacs command that would do it for me?

 a) M-x diff-buffer-with-file

 b) Save the file with C-u C-u C-x C-s, that is, the normal save command
    with two prefix arguments. It will force the previously saved file
    to become backup file and the current version is saved as the main
    file. Then compare them.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to create the patch from current file
  2009-07-15  9:22 how to create the patch from current file Michal
  2009-07-15  9:40 ` Teemu Likonen
@ 2009-07-15  9:46 ` Pascal J. Bourguignon
       [not found] ` <87ab36jnco.fsf@iki.fi>
  2 siblings, 0 replies; 6+ messages in thread
From: Pascal J. Bourguignon @ 2009-07-15  9:46 UTC (permalink / raw)
  To: help-gnu-emacs

Michal <rabbitko@tenbit.pl> writes:

> Hallo group readers.
>
> Imagine the following situation:
> I just changed some part of file, but did not save it.
> Now I want to create a patch comparing to the original file.
> Do You know any emacs command that would do it for me?

C-x C-w newfile RET
M-x diff RET newfile RET oldfile RET

Eventually: M-x rename-file RET newfile RET oldfile RET
to override the oldfile by the newfile.


> Optionally I can imagine that this might even be possible after I saved
> a file. Then file~ could be used as a version before changes?

Don't count on it.  The time when a backup file is created is not
always what you'd want it to be.

-- 
__Pascal Bourguignon__


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to create the patch from current file
  2009-07-15  9:40 ` Teemu Likonen
@ 2009-07-15  9:52   ` Pascal J. Bourguignon
  2009-07-15 15:04   ` Michal
  1 sibling, 0 replies; 6+ messages in thread
From: Pascal J. Bourguignon @ 2009-07-15  9:52 UTC (permalink / raw)
  To: help-gnu-emacs

Teemu Likonen <tlikonen@iki.fi> writes:

> On 2009-07-15 11:22 (+0200), Michal wrote:
>
>> Imagine the following situation:
>> I just changed some part of file, but did not save it.
>> Now I want to create a patch comparing to the original file.
>> Do You know any emacs command that would do it for me?
>
>  a) M-x diff-buffer-with-file

That's great! 


>  b) Save the file with C-u C-u C-x C-s, that is, the normal save command
>     with two prefix arguments. It will force the previously saved file
>     to become backup file and the current version is saved as the main
>     file. Then compare them.

-- 
__Pascal Bourguignon__


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to create the patch from current file
       [not found] ` <87ab36jnco.fsf@iki.fi>
@ 2009-07-15 10:34   ` Bernardo
  0 siblings, 0 replies; 6+ messages in thread
From: Bernardo @ 2009-07-15 10:34 UTC (permalink / raw)
  To: help-gnu-emacs



Teemu Likonen said the following on 15/07/09 19:40:
> On 2009-07-15 11:22 (+0200), Michal wrote:
> 
>> Imagine the following situation:
>> I just changed some part of file, but did not save it.
>> Now I want to create a patch comparing to the original file.
>> Do You know any emacs command that would do it for me?
> 
>  1) M-x diff-buffer-with-file
> 
>  2) Save the file with C-u C-u C-x C-s, that is, the normal save command
>     with two prefix arguments. It will force the previously saved file
>     to become backup file and the current version is saved as the main
>     file. Then compare them.
> 
an alternative is (before saving the file) to type:
C-x s d
this will show you the diff

if you bail out with C-g you can still switch back to *Diff* buffer and 
save it




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to create the patch from current file
  2009-07-15  9:40 ` Teemu Likonen
  2009-07-15  9:52   ` Pascal J. Bourguignon
@ 2009-07-15 15:04   ` Michal
  1 sibling, 0 replies; 6+ messages in thread
From: Michal @ 2009-07-15 15:04 UTC (permalink / raw)
  To: help-gnu-emacs

Teemu Likonen <tlikonen@iki.fi> writes:

>  a) M-x diff-buffer-with-file
>
>  b) Save the file with C-u C-u C-x C-s, that is, the normal save command
>     with two prefix arguments. It will force the previously saved file
>     to become backup file and the current version is saved as the main
>     file. Then compare them.


Thank All of You for great help.
regards


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-07-15 15:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15  9:22 how to create the patch from current file Michal
2009-07-15  9:40 ` Teemu Likonen
2009-07-15  9:52   ` Pascal J. Bourguignon
2009-07-15 15:04   ` Michal
2009-07-15  9:46 ` Pascal J. Bourguignon
     [not found] ` <87ab36jnco.fsf@iki.fi>
2009-07-15 10:34   ` Bernardo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).