unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling.
@ 2017-09-12 18:01 Oleksandr Gavenko
  2019-06-24 16:13 ` Lars Ingebrigtsen
  2022-08-23  9:36 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 8+ messages in thread
From: Oleksandr Gavenko @ 2017-09-12 18:01 UTC (permalink / raw)
  To: 28434

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/





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

* bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling.
  2017-09-12 18:01 bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling Oleksandr Gavenko
@ 2019-06-24 16:13 ` Lars Ingebrigtsen
  2019-06-24 22:50   ` Noam Postavsky
  2022-08-23  9:36 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-24 16:13 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 28434

Oleksandr Gavenko <gavenkoa@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





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

* bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling.
  2019-06-24 16:13 ` Lars Ingebrigtsen
@ 2019-06-24 22:50   ` Noam Postavsky
  2019-06-24 23:09     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Noam Postavsky @ 2019-06-24 22:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 28434, Oleksandr Gavenko

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Oleksandr Gavenko <gavenkoa@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?






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

* bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling.
  2019-06-24 22:50   ` Noam Postavsky
@ 2019-06-24 23:09     ` Lars Ingebrigtsen
  2019-06-24 23:58       ` Noam Postavsky
  2019-06-25  2:41       ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-24 23:09 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 28434, Oleksandr Gavenko

Noam Postavsky <npostavs@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





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

* bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling.
  2019-06-24 23:09     ` Lars Ingebrigtsen
@ 2019-06-24 23:58       ` Noam Postavsky
  2019-06-25 11:16         ` Lars Ingebrigtsen
  2019-06-25  2:41       ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Noam Postavsky @ 2019-06-24 23:58 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 28434, Oleksandr Gavenko

reopen 28434
tags 28434 - wontfix
severity 28434 minor
quit

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Noam Postavsky <npostavs@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.






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

* bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling.
  2019-06-24 23:09     ` Lars Ingebrigtsen
  2019-06-24 23:58       ` Noam Postavsky
@ 2019-06-25  2:41       ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2019-06-25  2:41 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 28434, npostavs, gavenkoa

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Tue, 25 Jun 2019 01:09:59 +0200
> Cc: 28434@debbugs.gnu.org, Oleksandr Gavenko <gavenkoa@gmail.com>
> 
> Noam Postavsky <npostavs@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.





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

* bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling.
  2019-06-24 23:58       ` Noam Postavsky
@ 2019-06-25 11:16         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-25 11:16 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 28434, Oleksandr Gavenko

Noam Postavsky <npostavs@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





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

* bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling.
  2017-09-12 18:01 bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling Oleksandr Gavenko
  2019-06-24 16:13 ` Lars Ingebrigtsen
@ 2022-08-23  9:36 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-23  9:36 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 28434

Oleksandr Gavenko <gavenkoa@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.





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

end of thread, other threads:[~2022-08-23  9:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-12 18:01 bug#28434: 25.2; Final "\ No newline at end of file" breaks Emacs patch handling Oleksandr Gavenko
2019-06-24 16:13 ` Lars Ingebrigtsen
2019-06-24 22:50   ` Noam Postavsky
2019-06-24 23:09     ` Lars Ingebrigtsen
2019-06-24 23:58       ` Noam Postavsky
2019-06-25 11:16         ` Lars Ingebrigtsen
2019-06-25  2:41       ` Eli Zaretskii
2022-08-23  9:36 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).