GNU bug report logs - #28434
25.2; Final "\ No newline at end of file" breaks Emacs patch handling.

Previous Next

Package: emacs;

Reported by: Oleksandr Gavenko <gavenkoa <at> gmail.com>

Date: Tue, 12 Sep 2017 18:02:01 UTC

Severity: minor

Found in version 25.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 28434 in the body.
You can then email your comments to 28434 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-gnu-emacs <at> gnu.org:
bug#28434; Package emacs. (Tue, 12 Sep 2017 18:02:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleksandr Gavenko <gavenkoa <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 Sep 2017 18:02:03 GMT) Full text and rfc822 format available.

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

From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling.
Date: Tue, 12 Sep 2017 21:01:14 +0300
In GNU Emacs 25.2.1 (i686-w64-mingw32)
 of 2017-04-24 built on LAPHROAIG

It happens with a lot of tools (diff/hg/git). If file doesn't end on new line
diff file has:

  \ No newline at end of file

C-c C-c (diff-goto-source) on that hunk says:

  Hunk text not found

C-c C-a (diff-apply-hunk) says:

  diff-apply-hunk: Can’t find the text to patch

It's very annoying as I have no control over file content and sometime can't
add final new line.

Emacs commands in diff mode should tolerate ``\`` message about missing final
new line.

ediff-diff-ok-lines-regexp is:

  "^\\([0-9,]+[acd][0-9,]+?$\\|[<>] \\|---\\|.*Warning *:\\|.*No +newline\\|.*missing +newline\\|^?$\\)"

and match that line.

I live with that problem from Emacs 22.x or so. Surprised why no one fixed it yet.

-- 
http://defun.work/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28434; Package emacs. (Mon, 24 Jun 2019 16:14:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 28434 <at> debbugs.gnu.org
Subject: Re: bug#28434: 25.2;
 Final "\ No newline at end of file" breaks Emacs patch handling.
Date: Mon, 24 Jun 2019 18:13:48 +0200
Oleksandr Gavenko <gavenkoa <at> gmail.com> writes:

> It's very annoying as I have no control over file content and sometime can't
> add final new line.

I think that's kind of unusual -- most text file formats can end in
newlines.

> Emacs commands in diff mode should tolerate ``\`` message about missing final
> new line.
>
> ediff-diff-ok-lines-regexp is:
>
>   "^\\([0-9,]+[acd][0-9,]+?$\\|[<>] \\|---\\|.*Warning *:\\|.*No +newline\\|.*missing +newline\\|^?$\\)"
>
> and match that line.

I think if you need this, you should add it to that variable, but I
don't think this would be a good default.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 24 Jun 2019 16:14:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 28434 <at> debbugs.gnu.org and Oleksandr Gavenko <gavenkoa <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 24 Jun 2019 16:14:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28434; Package emacs. (Mon, 24 Jun 2019 22:52:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 28434 <at> debbugs.gnu.org, Oleksandr Gavenko <gavenkoa <at> gmail.com>
Subject: Re: bug#28434: 25.2;
 Final "\ No newline at end of file" breaks Emacs patch handling.
Date: Mon, 24 Jun 2019 18:50:58 -0400
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Oleksandr Gavenko <gavenkoa <at> gmail.com> writes:
>
>> It's very annoying as I have no control over file content and sometime can't
>> add final new line.
>
> I think that's kind of unusual -- most text file formats can end in
> newlines.
>
>> Emacs commands in diff mode should tolerate ``\`` message about missing final
>> new line.
>>
>> ediff-diff-ok-lines-regexp is:
>>
>>   "^\\([0-9,]+[acd][0-9,]+?$\\|[<>] \\|---\\|.*Warning *:\\|.*No +newline\\|.*missing +newline\\|^?$\\)"
>>
>> and match that line.
>
> I think if you need this, you should add it to that variable, but I
> don't think this would be a good default.

Hmm, the "\ No newline at end of file" thing is a de facto standard, so
shouldn't Emacs recognize it by default?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28434; Package emacs. (Mon, 24 Jun 2019 23:11:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 28434 <at> debbugs.gnu.org, Oleksandr Gavenko <gavenkoa <at> gmail.com>
Subject: Re: bug#28434: 25.2;
 Final "\ No newline at end of file" breaks Emacs patch handling.
Date: Tue, 25 Jun 2019 01:09:59 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

>> I think if you need this, you should add it to that variable, but I
>> don't think this would be a good default.
>
> Hmm, the "\ No newline at end of file" thing is a de facto standard, so
> shouldn't Emacs recognize it by default?

Hm...  is it?  I've always thought that was Emacs telling me I was doing
something wrong.  :-)

But if that's the case, then perhaps we should add it?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28434; Package emacs. (Mon, 24 Jun 2019 23:59:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 28434 <at> debbugs.gnu.org, Oleksandr Gavenko <gavenkoa <at> gmail.com>
Subject: Re: bug#28434: 25.2;
 Final "\ No newline at end of file" breaks Emacs patch handling.
Date: Mon, 24 Jun 2019 19:58:32 -0400
reopen 28434
tags 28434 - wontfix
severity 28434 minor
quit

Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Noam Postavsky <npostavs <at> gmail.com> writes:
>
>>> I think if you need this, you should add it to that variable, but I
>>> don't think this would be a good default.
>>
>> Hmm, the "\ No newline at end of file" thing is a de facto standard, so
>> shouldn't Emacs recognize it by default?
>
> Hm...  is it?  I've always thought that was Emacs telling me I was doing
> something wrong.  :-)

$ diff --version | head -2
diff (GNU diffutils) 3.5
Copyright (C) 2016 Free Software Foundation, Inc.
$ diff -u <(echo -n foo) <(echo foo)
--- /dev/fd/63	2019-06-24 19:55:40.217569759 -0400
+++ /dev/fd/62	2019-06-24 19:55:40.217569759 -0400
@@ -1 +1 @@
-foo
\ No newline at end of file
+foo

> But if that's the case, then perhaps we should add it?

Yeah I think so.





Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Jun 2019 23:59:03 GMT) Full text and rfc822 format available.

Removed tag(s) wontfix. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 24 Jun 2019 23:59:03 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 24 Jun 2019 23:59:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28434; Package emacs. (Tue, 25 Jun 2019 02:42:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 28434 <at> debbugs.gnu.org, npostavs <at> gmail.com, gavenkoa <at> gmail.com
Subject: Re: bug#28434: 25.2;
 Final "\ No newline at end of file" breaks Emacs patch handling.
Date: Tue, 25 Jun 2019 05:41:46 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Tue, 25 Jun 2019 01:09:59 +0200
> Cc: 28434 <at> debbugs.gnu.org, Oleksandr Gavenko <gavenkoa <at> gmail.com>
> 
> Noam Postavsky <npostavs <at> gmail.com> writes:
> 
> >> I think if you need this, you should add it to that variable, but I
> >> don't think this would be a good default.
> >
> > Hmm, the "\ No newline at end of file" thing is a de facto standard, so
> > shouldn't Emacs recognize it by default?
> 
> Hm...  is it?  I've always thought that was Emacs telling me I was doing
> something wrong.  :-)

It comes from Diff.

> But if that's the case, then perhaps we should add it?

Yes, I think so.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28434; Package emacs. (Tue, 25 Jun 2019 11:17:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 28434 <at> debbugs.gnu.org, Oleksandr Gavenko <gavenkoa <at> gmail.com>
Subject: Re: bug#28434: 25.2;
 Final "\ No newline at end of file" breaks Emacs patch handling.
Date: Tue, 25 Jun 2019 13:16:15 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

>> But if that's the case, then perhaps we should add it?
>
> Yeah I think so.

I misread what this bug report was about, too --
ediff-diff-ok-lines-regexp already matches the output, but the problem
is that

> C-c C-c (diff-goto-source) on that hunk says:

>   Hunk text not found

> C-c C-a (diff-apply-hunk) says:

>   diff-apply-hunk: Can’t find the text to patch

the presence of the line still makes various commands bug out...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28434; Package emacs. (Tue, 23 Aug 2022 09:37:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 28434 <at> debbugs.gnu.org
Subject: Re: bug#28434: 25.2; Final "\ No newline at end of file" breaks
 Emacs patch handling.
Date: Tue, 23 Aug 2022 11:36:15 +0200
Oleksandr Gavenko <gavenkoa <at> gmail.com> writes:

> It happens with a lot of tools (diff/hg/git). If file doesn't end on new line
> diff file has:
>
>   \ No newline at end of file
>
> C-c C-c (diff-goto-source) on that hunk says:
>
>   Hunk text not found
>
> C-c C-a (diff-apply-hunk) says:
>
>   diff-apply-hunk: Can’t find the text to patch

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

This has been fixed in Emacs 28.1, as far as I can tell.




bug marked as fixed in version 28.1, send any further explanations to 28434 <at> debbugs.gnu.org and Oleksandr Gavenko <gavenkoa <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 23 Aug 2022 09:37: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. (Tue, 20 Sep 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 296 days ago.

Previous Next


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