GNU bug report logs - #3348
23.0.92.1; Ediff: Creating a multi-file patch

Previous Next

Package: emacs;

Reported by: Jon Strait <jstrait <at> moonloop.net>

Date: Fri, 22 May 2009 03:45:03 UTC

Severity: minor

Tags: confirmed, patch

Found in version 25.0.94

Fixed in version 31.1

Done: Mauro Aranda <maurooaranda <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3348 in the body.
You can then email your comments to 3348 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3348; Package emacs. (Fri, 22 May 2009 03:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jon Strait <jstrait <at> moonloop.net>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 22 May 2009 03:45:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Jon Strait <jstrait <at> moonloop.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.0.92.1; Ediff: Creating a multi-file patch
Date: Thu, 21 May 2009 20:34:57 -0700
The modified flag is not being set on the patch results buffer when 
ediff-collect-custom-diffs is rerun.

1. Mark the sessions within an ediff-directories session.
2. Run ediff-collect-custom-diffs, which creates a multi-file     patch 
and displays the buffer with this patch.
3. Save this buffer to a file 'foo.patch' with write-file.
4. Change one of the files included in the session group.
5. Run ediff-collect-custom-diffs on the same session             group 
again.
6. The new patch will be displayed as the buffer 'foo.patch',     but 
the buffer's modified flag is not set.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3348; Package emacs. (Fri, 03 Jun 2016 20:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 3348 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: 3348 <at> debbugs.gnu.org
Subject: 23.0.92.1; Ediff: Creating a multi-file patch
Date: Fri, 3 Jun 2016 16:10:41 -0400
tag 3348 + confirmed
severity 3348 minor
found 3348 25.0.94
quit

Confirmed this is still an issue. Here is an elisp script for easier
reproduction (run as emacs -Q -l bug-3348.el):

(defconst bug-3348-test-dir
  (expand-file-name "bug-3348-testdir" temporary-file-directory))
(make-directory bug-3348-test-dir t)
(cd bug-3348-test-dir)

(make-directory "dir-a" t)
(make-directory "dir-b" t)

(with-temp-file "dir-a/file"
  (insert "aaa"))
(with-temp-file "dir-b/file"
  (insert "bbb"))

(ediff-directories "dir-a" "dir-b" nil)
(switch-to-buffer "*Ediff Session Group Panel*")

(ediff-next-meta-item 1)
(ediff-mark-for-operation-at-pos nil)
(ediff-collect-custom-diffs)

(with-current-buffer "*Ediff Multifile Diffs*"
  (write-file "foo.patch"))

(with-temp-file "dir-b/file"
  (insert "BBB"))

(ediff-collect-custom-diffs)

(switch-to-buffer "foo.patch")
(diff-buffer-with-file)
(message (concat "Observe foo.patch buffer is different from its file,\n"
                 "but is marked read-only, not modified"))




Added tag(s) confirmed. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Fri, 03 Jun 2016 20:11:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Fri, 03 Jun 2016 20:11:02 GMT) Full text and rfc822 format available.

bug Marked as found in versions 25.0.94. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Fri, 03 Jun 2016 20:11:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3348; Package emacs. (Sun, 15 Oct 2023 11:18:01 GMT) Full text and rfc822 format available.

Message #17 received at 3348 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: 3348 <at> debbugs.gnu.org
Cc: jstrait <at> moonloop.net, Noam Postavsky <npostavs <at> users.sourceforge.net>
Subject: Re: bug#3348: 23.0.92.1; Ediff: Creating a multi-file patch
Date: Sun, 15 Oct 2023 08:16:46 -0300
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:

> tag 3348 + confirmed
> severity 3348 minor
> found 3348 25.0.94
> quit
>
> Confirmed this is still an issue. Here is an elisp script for easier
> reproduction (run as emacs -Q -l bug-3348.el):
>
> (defconst bug-3348-test-dir
>   (expand-file-name "bug-3348-testdir" temporary-file-directory))
> (make-directory bug-3348-test-dir t)
> (cd bug-3348-test-dir)
>
> (make-directory "dir-a" t)
> (make-directory "dir-b" t)
>
> (with-temp-file "dir-a/file"
>   (insert "aaa"))
> (with-temp-file "dir-b/file"
>   (insert "bbb"))
>
> (ediff-directories "dir-a" "dir-b" nil)
> (switch-to-buffer "*Ediff Session Group Panel*")
>
> (ediff-next-meta-item 1)
> (ediff-mark-for-operation-at-pos nil)
> (ediff-collect-custom-diffs)
>
> (with-current-buffer "*Ediff Multifile Diffs*"
>   (write-file "foo.patch"))
>
> (with-temp-file "dir-b/file"
>   (insert "BBB"))
>
> (ediff-collect-custom-diffs)
>
> (switch-to-buffer "foo.patch")
> (diff-buffer-with-file)
> (message (concat "Observe foo.patch buffer is different from its file,\n"
>                  "but is marked read-only, not modified"))

This still happens, but I'm not really sure if this should be called a
bug.  ediff-collect-custom-diffs explicitly marks this buffer as not
modified with (set-buffer-modified-p nil).  I can't find the reasons for
that, but that doesn't mean there isn't a good one.  And it is
consistent about doing that.

The first call to ediff-collect-custom-diffs creates the buffer
*Ediff Multifile Diffs* and also marks it as unmodified, even though it
is.  So, why is that not a problem? Why is the second time a problem?

Using write-file again is possible, so what are the expectations of the
second time of typing `P' (or calling ediff-collect-custom-diffs) and
why do they differ from the expectations for the 1st call?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3348; Package emacs. (Sat, 01 Mar 2025 11:04:02 GMT) Full text and rfc822 format available.

Message #20 received at 3348 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: 3348 <at> debbugs.gnu.org
Cc: jstrait <at> moonloop.net, Noam Postavsky <npostavs <at> users.sourceforge.net>
Subject: Re: bug#3348: 23.0.92.1; Ediff: Creating a multi-file patch
Date: Sat, 1 Mar 2025 08:02:57 -0300
[Message part 1 (text/plain, inline)]
Mauro Aranda <maurooaranda <at> gmail.com> writes:

> Noam Postavsky <npostavs <at> users.sourceforge.net> writes:
>
>> tag 3348 + confirmed
>> severity 3348 minor
>> found 3348 25.0.94
>> quit
>>
>> Confirmed this is still an issue. Here is an elisp script for easier
>> reproduction (run as emacs -Q -l bug-3348.el):
>>
>> (defconst bug-3348-test-dir
>>   (expand-file-name "bug-3348-testdir" temporary-file-directory))
>> (make-directory bug-3348-test-dir t)
>> (cd bug-3348-test-dir)
>>
>> (make-directory "dir-a" t)
>> (make-directory "dir-b" t)
>>
>> (with-temp-file "dir-a/file"
>>   (insert "aaa"))
>> (with-temp-file "dir-b/file"
>>   (insert "bbb"))
>>
>> (ediff-directories "dir-a" "dir-b" nil)
>> (switch-to-buffer "*Ediff Session Group Panel*")
>>
>> (ediff-next-meta-item 1)
>> (ediff-mark-for-operation-at-pos nil)
>> (ediff-collect-custom-diffs)
>>
>> (with-current-buffer "*Ediff Multifile Diffs*"
>>   (write-file "foo.patch"))
>>
>> (with-temp-file "dir-b/file"
>>   (insert "BBB"))
>>
>> (ediff-collect-custom-diffs)
>>
>> (switch-to-buffer "foo.patch")
>> (diff-buffer-with-file)
>> (message (concat "Observe foo.patch buffer is different from its 
file,\n"
>>                  "but is marked read-only, not modified"))
>
> This still happens, but I'm not really sure if this should be called a
> bug.  ediff-collect-custom-diffs explicitly marks this buffer as not
> modified with (set-buffer-modified-p nil).  I can't find the reasons for
> that, but that doesn't mean there isn't a good one.  And it is
> consistent about doing that.
>
> The first call to ediff-collect-custom-diffs creates the buffer
> *Ediff Multifile Diffs* and also marks it as unmodified, even though it
> is.  So, why is that not a problem? Why is the second time a problem?
>
> Using write-file again is possible, so what are the expectations of the
> second time of typing `P' (or calling ediff-collect-custom-diffs) and
> why do they differ from the expectations for the 1st call?

After a year and a half, I think I got it :-)

After the call to write-file, ediff-meta-diff-buffer is visting a file,
and ediff assumes it never visits a file: that's why it erases, refills
it, and marks it as not modified.

So I think the attached patch fixes it.
[0001-Guard-against-user-saving-ediff-meta-diff-buffer.patch (text/x-patch, attachment)]

Added tag(s) patch. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 02 Mar 2025 01:36:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3348; Package emacs. (Sun, 09 Mar 2025 09:53:02 GMT) Full text and rfc822 format available.

Message #25 received at 3348 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 3348 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net, jstrait <at> moonloop.net
Subject: Re: bug#3348: 23.0.92.1; Ediff: Creating a multi-file patch
Date: Sun, 09 Mar 2025 11:52:43 +0200
> Cc: jstrait <at> moonloop.net, Noam Postavsky <npostavs <at> users.sourceforge.net>
> Date: Sat, 1 Mar 2025 08:02:57 -0300
> From: Mauro Aranda <maurooaranda <at> gmail.com>
> 
> Mauro Aranda <maurooaranda <at> gmail.com> writes:
> 
>  > Noam Postavsky <npostavs <at> users.sourceforge.net> writes:
>  >
>  >> tag 3348 + confirmed
>  >> severity 3348 minor
>  >> found 3348 25.0.94
>  >> quit
>  >>
>  >> Confirmed this is still an issue. Here is an elisp script for easier
>  >> reproduction (run as emacs -Q -l bug-3348.el):
>  >>
>  >> (defconst bug-3348-test-dir
>  >>   (expand-file-name "bug-3348-testdir" temporary-file-directory))
>  >> (make-directory bug-3348-test-dir t)
>  >> (cd bug-3348-test-dir)
>  >>
>  >> (make-directory "dir-a" t)
>  >> (make-directory "dir-b" t)
>  >>
>  >> (with-temp-file "dir-a/file"
>  >>   (insert "aaa"))
>  >> (with-temp-file "dir-b/file"
>  >>   (insert "bbb"))
>  >>
>  >> (ediff-directories "dir-a" "dir-b" nil)
>  >> (switch-to-buffer "*Ediff Session Group Panel*")
>  >>
>  >> (ediff-next-meta-item 1)
>  >> (ediff-mark-for-operation-at-pos nil)
>  >> (ediff-collect-custom-diffs)
>  >>
>  >> (with-current-buffer "*Ediff Multifile Diffs*"
>  >>   (write-file "foo.patch"))
>  >>
>  >> (with-temp-file "dir-b/file"
>  >>   (insert "BBB"))
>  >>
>  >> (ediff-collect-custom-diffs)
>  >>
>  >> (switch-to-buffer "foo.patch")
>  >> (diff-buffer-with-file)
>  >> (message (concat "Observe foo.patch buffer is different from its 
> file,\n"
>  >>                  "but is marked read-only, not modified"))
>  >
>  > This still happens, but I'm not really sure if this should be called a
>  > bug.  ediff-collect-custom-diffs explicitly marks this buffer as not
>  > modified with (set-buffer-modified-p nil).  I can't find the reasons for
>  > that, but that doesn't mean there isn't a good one.  And it is
>  > consistent about doing that.
>  >
>  > The first call to ediff-collect-custom-diffs creates the buffer
>  > *Ediff Multifile Diffs* and also marks it as unmodified, even though it
>  > is.  So, why is that not a problem? Why is the second time a problem?
>  >
>  > Using write-file again is possible, so what are the expectations of the
>  > second time of typing `P' (or calling ediff-collect-custom-diffs) and
>  > why do they differ from the expectations for the 1st call?
> 
> After a year and a half, I think I got it :-)
> 
> After the call to write-file, ediff-meta-diff-buffer is visting a file,
> and ediff assumes it never visits a file: that's why it erases, refills
> it, and marks it as not modified.
> 
> So I think the attached patch fixes it.

Feel free to install on master, and thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3348; Package emacs. (Sun, 09 Mar 2025 11:17:02 GMT) Full text and rfc822 format available.

Message #28 received at 3348 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 3348 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net, jstrait <at> moonloop.net
Subject: Re: bug#3348: 23.0.92.1; Ediff: Creating a multi-file patch
Date: Sun, 9 Mar 2025 08:15:50 -0300
close 3348 31.1
quit


On 9/3/25 06:52, Eli Zaretskii wrote:
>> Cc: jstrait <at> moonloop.net, Noam Postavsky 
<npostavs <at> users.sourceforge.net>
>> Date: Sat, 1 Mar 2025 08:02:57 -0300
>> From: Mauro Aranda <maurooaranda <at> gmail.com>
>>
>> Mauro Aranda <maurooaranda <at> gmail.com> writes:
>>
>>  > Noam Postavsky <npostavs <at> users.sourceforge.net> writes:
>>  >
>>  >> tag 3348 + confirmed
>>  >> severity 3348 minor
>>  >> found 3348 25.0.94
>>  >> quit
>>  >>
>>  >> Confirmed this is still an issue. Here is an elisp script for easier
>>  >> reproduction (run as emacs -Q -l bug-3348.el):
>>  >>
>>  >> (defconst bug-3348-test-dir
>>  >>   (expand-file-name "bug-3348-testdir" temporary-file-directory))
>>  >> (make-directory bug-3348-test-dir t)
>>  >> (cd bug-3348-test-dir)
>>  >>
>>  >> (make-directory "dir-a" t)
>>  >> (make-directory "dir-b" t)
>>  >>
>>  >> (with-temp-file "dir-a/file"
>>  >>   (insert "aaa"))
>>  >> (with-temp-file "dir-b/file"
>>  >>   (insert "bbb"))
>>  >>
>>  >> (ediff-directories "dir-a" "dir-b" nil)
>>  >> (switch-to-buffer "*Ediff Session Group Panel*")
>>  >>
>>  >> (ediff-next-meta-item 1)
>>  >> (ediff-mark-for-operation-at-pos nil)
>>  >> (ediff-collect-custom-diffs)
>>  >>
>>  >> (with-current-buffer "*Ediff Multifile Diffs*"
>>  >>   (write-file "foo.patch"))
>>  >>
>>  >> (with-temp-file "dir-b/file"
>>  >>   (insert "BBB"))
>>  >>
>>  >> (ediff-collect-custom-diffs)
>>  >>
>>  >> (switch-to-buffer "foo.patch")
>>  >> (diff-buffer-with-file)
>>  >> (message (concat "Observe foo.patch buffer is different from its
>> file,\n"
>>  >>                  "but is marked read-only, not modified"))
>>  >
>>  > This still happens, but I'm not really sure if this should be 
called a
>>  > bug.  ediff-collect-custom-diffs explicitly marks this buffer as not
>>  > modified with (set-buffer-modified-p nil).  I can't find the 
reasons for
>>  > that, but that doesn't mean there isn't a good one.  And it is
>>  > consistent about doing that.
>>  >
>>  > The first call to ediff-collect-custom-diffs creates the buffer
>>  > *Ediff Multifile Diffs* and also marks it as unmodified, even 
though it
>>  > is.  So, why is that not a problem? Why is the second time a problem?
>>  >
>>  > Using write-file again is possible, so what are the expectations 
of the
>>  > second time of typing `P' (or calling ediff-collect-custom-diffs) and
>>  > why do they differ from the expectations for the 1st call?
>>
>> After a year and a half, I think I got it :-)
>>
>> After the call to write-file, ediff-meta-diff-buffer is visting a file,
>> and ediff assumes it never visits a file: that's why it erases, refills
>> it, and marks it as not modified.
>>
>> So I think the attached patch fixes it.
>
> Feel free to install on master, and thanks.

Thanks.  Done, and closing the bug.





bug marked as fixed in version 31.1, send any further explanations to 3348 <at> debbugs.gnu.org and Jon Strait <jstrait <at> moonloop.net> Request was from Mauro Aranda <maurooaranda <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 09 Mar 2025 11:17:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Apr 2025 11:24:20 GMT) Full text and rfc822 format available.

This bug report was last modified 33 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.