unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* ediff & No newline at end of file
@ 2008-06-20  9:40 sandro dentella
  2008-06-20  9:44 ` sandro dentella
  2008-06-21 14:47 ` Kevin Rodgers
  0 siblings, 2 replies; 7+ messages in thread
From: sandro dentella @ 2008-06-20  9:40 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

   I'm a happy user of ediff, both for diff and  merge. What I have
not been able to to
  and I really need is to configure it  _NOT_  to complain about
missing newline ad the
  end of a file.

  I frequently need to compare files and I really don't mind if they
have a final newline or not.
  It's ok a warning but I want it to go ahead and show the differences
while now
  I just see a single buffer with the warning and no ediff windows/
panel.


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

* Re: ediff & No newline at end of file
  2008-06-20  9:40 ediff & No newline at end of file sandro dentella
@ 2008-06-20  9:44 ` sandro dentella
  2008-06-21  5:03   ` Thierry Volpiatto
       [not found]   ` <mailman.13646.1214024246.18990.help-gnu-emacs@gnu.org>
  2008-06-21 14:47 ` Kevin Rodgers
  1 sibling, 2 replies; 7+ messages in thread
From: sandro dentella @ 2008-06-20  9:44 UTC (permalink / raw)
  To: help-gnu-emacs

sorry. I sent it before ending the message...

I'm calling ediff from a script as:

emacs --eval "(ediff-files \"$1\"  \"$2\")"

if on of the 2 file have a missing newline the above command will
fail.

Any Hint?

Thanks in advance

sandro
*:-)


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

* Re: ediff & No newline at end of file
  2008-06-20  9:44 ` sandro dentella
@ 2008-06-21  5:03   ` Thierry Volpiatto
       [not found]   ` <mailman.13646.1214024246.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Thierry Volpiatto @ 2008-06-21  5:03 UTC (permalink / raw)
  To: sandro dentella; +Cc: help-gnu-emacs

Hi,
that will not correct your problem but help in the future.

,----
| ;; Add newline at end of files
| (setq require-final-newline t)
`----
Now when you edit a file and you save it it will have a newline at end.

sandro dentella <sandro@e-den.it> writes:

> sorry. I sent it before ending the message...
>
> I'm calling ediff from a script as:
>
> emacs --eval "(ediff-files \"$1\"  \"$2\")"
>
> if on of the 2 file have a missing newline the above command will
> fail.
>
> Any Hint?
>
> Thanks in advance
>
> sandro
> *:-)
>

-- 
A + Thierry
Pub key: http://pgp.mit.edu




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

* Re: ediff & No newline at end of file
       [not found]   ` <mailman.13646.1214024246.18990.help-gnu-emacs@gnu.org>
@ 2008-06-21  7:28     ` sandro dentella
  2008-06-21  8:32       ` Thierry Volpiatto
  0 siblings, 1 reply; 7+ messages in thread
From: sandro dentella @ 2008-06-21  7:28 UTC (permalink / raw)
  To: help-gnu-emacs

On 21 Giu, 07:03, Thierry Volpiatto <thierry.volpia...@gmail.com>
wrote:
> Hi,
> that will not correct your problem but help in the future.
>
> ,----
> | ;; Add newline at end of files
> | (setq require-final-newline t)
> `----
> Now when you edit a file and you save it it will have a newline at end.


I already have it, the fact is that I use if with files generated by
others as well...

sandro
*:-)


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

* Re: ediff & No newline at end of file
  2008-06-21  7:28     ` sandro dentella
@ 2008-06-21  8:32       ` Thierry Volpiatto
  2008-06-21  8:45         ` sandro dentella
  0 siblings, 1 reply; 7+ messages in thread
From: Thierry Volpiatto @ 2008-06-21  8:32 UTC (permalink / raw)
  To: sandro dentella; +Cc: help-gnu-emacs

sandro dentella <sandro@e-den.it> writes:

> On 21 Giu, 07:03, Thierry Volpiatto <thierry.volpia...@gmail.com>
> wrote:
>> Hi,
>> that will not correct your problem but help in the future.
>>
>> ,----
>> | ;; Add newline at end of files
>> | (setq require-final-newline t)
>> `----
>> Now when you edit a file and you save it it will have a newline at end.
>
>
> I already have it, the fact is that I use if with files generated by
> others as well...
You can easily write a small function that take as args file1 and file2
and modify these files before calling ediff.
something like:

,----
| (find-file file1)
| (goto-char (point-max))
| (newline)
| (save-buffer)
| (kill-buffer (current-buffer))
`----
The same for file2 and then call ediff.
Should work.
-- 
A + Thierry
Pub key: http://pgp.mit.edu




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

* Re: ediff & No newline at end of file
  2008-06-21  8:32       ` Thierry Volpiatto
@ 2008-06-21  8:45         ` sandro dentella
  0 siblings, 0 replies; 7+ messages in thread
From: sandro dentella @ 2008-06-21  8:45 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: help-gnu-emacs

On Sat, Jun 21, 2008 at 10:32:42AM +0200, Thierry Volpiatto wrote:
> sandro dentella <sandro@e-den.it> writes:
> 
> > On 21 Giu, 07:03, Thierry Volpiatto <thierry.volpia...@gmail.com>
> > wrote:
> >> Hi,
> >> that will not correct your problem but help in the future.
> >>
> >> ,----
> >> | ;; Add newline at end of files
> >> | (setq require-final-newline t)
> >> `----
> >> Now when you edit a file and you save it it will have a newline at end.
> >
> >
> > I already have it, the fact is that I use if with files generated by
> > others as well...
> You can easily write a small function that take as args file1 and file2
> and modify these files before calling ediff.
> something like:

my wrote my 'emadiff' as:

  for f in $1 $2
  do
    if [ $(tail -n1 $f|wc -c |sed 's/ //') -gt 0 ] ; then
        echo -e "\n" >> $f
    fi
  done
  #gnuclient --eval "(ediff-buffers \"$f1\"  \"$f2\")"  $f1 $f2
  
  emacs --eval "(ediff-files \"$1\"  \"$2\")"  
  
so does exactly what you suggest, but I think is a workaround that I'd like
to avoid. It seems strange to me that emacs just stops working when it could
just issue a waring on nothing at all. I'd expect a configuration parameter
to silent it as there's a configuration parameter that says "add a newline
at the end".

Thanks anyhow

sandro
*:-)





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

* Re: ediff & No newline at end of file
  2008-06-20  9:40 ediff & No newline at end of file sandro dentella
  2008-06-20  9:44 ` sandro dentella
@ 2008-06-21 14:47 ` Kevin Rodgers
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2008-06-21 14:47 UTC (permalink / raw)
  To: help-gnu-emacs

sandro dentella wrote:
> Hi all,
> 
>    I'm a happy user of ediff, both for diff and  merge. What I have
> not been able to to
>   and I really need is to configure it  _NOT_  to complain about
> missing newline ad the
>   end of a file.
> 
>   I frequently need to compare files and I really don't mind if they
> have a final newline or not.
>   It's ok a warning but I want it to go ahead and show the differences
> while now
>   I just see a single buffer with the warning and no ediff windows/
> panel.

Hmmm, it seems like it ought to do the right thing out of the box:

,----[ C-h v ediff-diff-ok-lines-regexp RET ]
| ediff-diff-ok-lines-regexp is a variable defined in `ediff-diff.el'.
| Its value is
| "^\\([0-9,]+[acd][0-9,]+
?$\\|[<>] \\|---\\|.*Warning *:\\|.*No +newline\\|.*missing +newline\\|^
?$\\)"
|
|
| Documentation:
| Regexp that matches normal output lines from `ediff-diff-program'.
| This is mostly lifted from Emerge, except that Ediff also considers
| warnings and `Missing newline'-type messages to be normal output.
| Lines that do not match are assumed to be error messages.
|
| [back]
`----

-- 
Kevin Rodgers
Denver, Colorado, USA





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

end of thread, other threads:[~2008-06-21 14:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-20  9:40 ediff & No newline at end of file sandro dentella
2008-06-20  9:44 ` sandro dentella
2008-06-21  5:03   ` Thierry Volpiatto
     [not found]   ` <mailman.13646.1214024246.18990.help-gnu-emacs@gnu.org>
2008-06-21  7:28     ` sandro dentella
2008-06-21  8:32       ` Thierry Volpiatto
2008-06-21  8:45         ` sandro dentella
2008-06-21 14:47 ` Kevin Rodgers

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