* bug#1537: diff-mode for git patches trouble
@ 2008-12-11 13:08 Dmitriy Blinov
2008-12-11 19:04 ` Stefan Monnier
2020-08-16 17:00 ` bug#1536: " Stefan Kangas
0 siblings, 2 replies; 7+ messages in thread
From: Dmitriy Blinov @ 2008-12-11 13:08 UTC (permalink / raw
To: bug-gnu-emacs
There is the problem then I'm trying to edit git-generated patches in
emacs diff-mode.
git patches look like:
---
hello.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hello.txt b/hello.txt
index 55bf894..25a09cc 100644
--- a/hello.txt
+++ b/hello.txt
@@ -6,7 +6,7 @@
5
6
7
-8
+8 8
9
10
11
--
1.5.6.5
The last but one line is two minuses by default. And diff-mode
recognizes first minus as deleted string.
Therefore when we change some strings in patch, emacs creates malformed
hunk offset.
It will be @@ -6,8 +6,7 @@ insead of correct @@ -6,7 +6,7 @@ after patch
edition (if we don't delete/create strings).
Is it possible to fix this harm or I should append whitespace before
"--" string always?
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#1537: diff-mode for git patches trouble
2008-12-11 13:08 bug#1537: diff-mode for git patches trouble Dmitriy Blinov
@ 2008-12-11 19:04 ` Stefan Monnier
2008-12-12 6:57 ` Dmitriy Blinov
2020-08-16 17:00 ` bug#1536: " Stefan Kangas
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2008-12-11 19:04 UTC (permalink / raw
To: Dmitriy Blinov; +Cc: 1537, bug-gnu-emacs
> The last but one line is two minuses by default. And diff-mode
> recognizes first minus as deleted string. Therefore when we change
> some strings in patch, emacs creates malformed hunk offset. It will
> be @@ -6,8 +6,7 @@ insead of correct @@ -6,7 +6,7 @@ after patch
> edition (if we don't delete/create strings).
> Is it possible to fix this harm or I should append whitespace before "--"
> string always?
Given the way the code is currently implemented, it's difficult to fix
this problem. One of the problem is that we currently don't do anything
special before the user modifies the buffer. Not even in
a before-change-function. So by the time we try to update the hunk
header, the buffer has been modified and we don't know what it looked
like before.
I.e. to fix it we'll need to mark the end-of-hunk before the buffer is
really modified. E.g. by automatically adding an empty line at
end-of-hunk (or a marker).
Of course, in the general case the problem is insoluble (e.g. if you
edit the line with the "--"), but clearly we can do better in the
"normal" case.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#1537: diff-mode for git patches trouble
2008-12-11 19:04 ` Stefan Monnier
@ 2008-12-12 6:57 ` Dmitriy Blinov
2008-12-12 19:08 ` Stefan Monnier
0 siblings, 1 reply; 7+ messages in thread
From: Dmitriy Blinov @ 2008-12-12 6:57 UTC (permalink / raw
To: Stefan Monnier; +Cc: 1537, bug-gnu-emacs
> Of course, in the general case the problem is insoluble (e.g. if you
> edit the line with the "--"), but clearly we can do better in the
> "normal" case.
>
>
> Stefan
Probably it was incorrect to post this feature here. In fact it's git
problem but not emacs.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#1537: diff-mode for git patches trouble
2008-12-12 6:57 ` Dmitriy Blinov
@ 2008-12-12 19:08 ` Stefan Monnier
2008-12-12 19:15 ` Processed: " Emacs bug Tracking System
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2008-12-12 19:08 UTC (permalink / raw
To: Dmitriy Blinov; +Cc: 1537
severity 1537 wishlist
thanks
>> Of course, in the general case the problem is insoluble (e.g. if you
>> edit the line with the "--"), but clearly we can do better in the
>> "normal" case.
> Probably it was incorrect to post this feature here. In fact it's git
> problem but not emacs.
No, it definitely has its place here: while it's true that Git's output
is not very friendly to patch-editing as supported by diff-mode, the
output is formally correct and unambiguous.
And your example of changes is also unambiguous, so you can definitely
argue that Emacs should behave correctly in this case.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Processed: Re: bug#1537: diff-mode for git patches trouble
2008-12-12 19:08 ` Stefan Monnier
@ 2008-12-12 19:15 ` Emacs bug Tracking System
0 siblings, 0 replies; 7+ messages in thread
From: Emacs bug Tracking System @ 2008-12-12 19:15 UTC (permalink / raw
To: Stefan Monnier; +Cc: Emacs Bugs
Processing commands for control@emacsbugs.donarmstrong.com:
> severity 1537 wishlist
bug#1537: diff-mode for git patches trouble
bug#1536: diff-mode for git patches problem
Severity set to `wishlist' from `normal'
> thanks
Stopping processing here.
Please contact me if you need assistance.
Don Armstrong
(administrator, Emacs bugs database)
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#1536: bug#1537: diff-mode for git patches trouble
2008-12-11 13:08 bug#1537: diff-mode for git patches trouble Dmitriy Blinov
2008-12-11 19:04 ` Stefan Monnier
@ 2020-08-16 17:00 ` Stefan Kangas
2020-10-14 6:08 ` bug#1537: " Lars Ingebrigtsen
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2020-08-16 17:00 UTC (permalink / raw
To: Dmitriy Blinov; +Cc: 1537, 1536
Dmitriy Blinov <bda@mns.spb.ru> writes:
> There is the problem then I'm trying to edit git-generated patches in
> emacs diff-mode.
>
> git patches look like:
> ---
> hello.txt | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hello.txt b/hello.txt
> index 55bf894..25a09cc 100644
> --- a/hello.txt
> +++ b/hello.txt
> @@ -6,7 +6,7 @@
> 5
> 6
> 7
> -8
> +8 8
> 9
> 10
> 11
(That was 11 years ago.)
I can't reproduce this on current master. The numbers seem to update
correctly, as ar as I'm understanding from:
https://stackoverflow.com/questions/6508651/what-do-the-numbers-on-a-git-diff-header-mean
It would be useful if someone could double check this finding in case
there is something I'm missing. It could be quickly verified using:
git format-patch -1 ; ./src/emacs -Q *patch
And then edit any line in a patch to see if the numbers update correctly.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#1537: bug#1536: bug#1537: diff-mode for git patches trouble
2020-08-16 17:00 ` bug#1536: " Stefan Kangas
@ 2020-10-14 6:08 ` Lars Ingebrigtsen
0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-14 6:08 UTC (permalink / raw
To: Stefan Kangas; +Cc: 1537, 1536, Dmitriy Blinov
Stefan Kangas <stefan@marxist.se> writes:
> I can't reproduce this on current master. The numbers seem to update
> correctly, as ar as I'm understanding from:
>
> https://stackoverflow.com/questions/6508651/what-do-the-numbers-on-a-git-diff-header-mean
>
> It would be useful if someone could double check this finding in case
> there is something I'm missing. It could be quickly verified using:
>
> git format-patch -1 ; ./src/emacs -Q *patch
>
> And then edit any line in a patch to see if the numbers update correctly.
Yup; seems to update correctly for me, too, so I'm closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-10-14 6:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-11 13:08 bug#1537: diff-mode for git patches trouble Dmitriy Blinov
2008-12-11 19:04 ` Stefan Monnier
2008-12-12 6:57 ` Dmitriy Blinov
2008-12-12 19:08 ` Stefan Monnier
2008-12-12 19:15 ` Processed: " Emacs bug Tracking System
2020-08-16 17:00 ` bug#1536: " Stefan Kangas
2020-10-14 6:08 ` bug#1537: " Lars Ingebrigtsen
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.