unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* problem with system_eol_type
@ 2006-07-31  6:04 Kenichi Handa
  2006-07-31  9:46 ` Reiner Steib
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Kenichi Handa @ 2006-07-31  6:04 UTC (permalink / raw)
  Cc: mule-ja

I've got several complaints about the change I made a few
months ago regarding the handling of the default eol-type.

Previously, when a coding system without explicit eol-type
(e.g. iso-latin-1) was specified for encoding, Unix-like
eol-type is selected on any platform.

The change I made was to use an eol-type set to
system_eol_type (CRLF on Windows, LF otherwise) in such a
case.  To me, that change was just a bug fix.

But, the bug-reports say that there are many codes that
assumes the previous behaviour, and some of them now don't
work well on Windows.

I think that it is cleaner to ask a program to specify the
eol-type explicitly if it requires a specific eol-type on
encoding.  But, as long as the behavior is clearly
documented, it seems that the previous behaviour is also not
that bad.

What do people think?

---
Kenichi Handa
handa@m17n.org

PS.  I included mule-ja maining list in CC:.  Mule-ja
subscribers please write in English if you want to reply to
this mail.

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

* Re: problem with system_eol_type
  2006-07-31  6:04 problem with system_eol_type Kenichi Handa
@ 2006-07-31  9:46 ` Reiner Steib
  2006-07-31 16:30   ` Stefan Monnier
  2006-07-31 17:27 ` Eli Zaretskii
  2006-07-31 22:16 ` Richard Stallman
  2 siblings, 1 reply; 17+ messages in thread
From: Reiner Steib @ 2006-07-31  9:46 UTC (permalink / raw)
  Cc: mule-ja, emacs-devel

On Mon, Jul 31 2006, Kenichi Handa wrote:

> I've got several complaints about the change I made a few
> months ago regarding the handling of the default eol-type.
>
> Previously, when a coding system without explicit eol-type
> (e.g. iso-latin-1) was specified for encoding, Unix-like
> eol-type is selected on any platform.
>
> The change I made was to use an eol-type set to
> system_eol_type (CRLF on Windows, LF otherwise) in such a
> case.  To me, that change was just a bug fix.
>
> But, the bug-reports say that there are many codes that
> assumes the previous behaviour, and some of them now don't
> work well on Windows.

FWIW, two examples in Gnus where that doubled newlines appeared in
mail messages and NOV (overview) files weren't read/written correctly
anymore, see this discussion on the Gnus list:
<http://thread.gmane.org/gmane.emacs.gnus.general/63496/focus=63502>

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

* Re: problem with system_eol_type
  2006-07-31  9:46 ` Reiner Steib
@ 2006-07-31 16:30   ` Stefan Monnier
  2006-07-31 17:00     ` Jason Rumney
                       ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Stefan Monnier @ 2006-07-31 16:30 UTC (permalink / raw)
  Cc: mule-ja, emacs-devel

>>>>> "Reiner" == Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Mon, Jul 31 2006, Kenichi Handa wrote:
>> I've got several complaints about the change I made a few
>> months ago regarding the handling of the default eol-type.
>> 
>> Previously, when a coding system without explicit eol-type
>> (e.g. iso-latin-1) was specified for encoding, Unix-like
>> eol-type is selected on any platform.
>> 
>> The change I made was to use an eol-type set to
>> system_eol_type (CRLF on Windows, LF otherwise) in such a
>> case.  To me, that change was just a bug fix.
>> 
>> But, the bug-reports say that there are many codes that
>> assumes the previous behaviour, and some of them now don't
>> work well on Windows.

I'd argue that those pieces of code had bugs: if your code depends on a Unix
style EOL, it should say so explicitly.

> FWIW, two examples in Gnus where that doubled newlines appeared in
> mail messages and NOV (overview) files weren't read/written correctly
> anymore, see this discussion on the Gnus list:
> <http://thread.gmane.org/gmane.emacs.gnus.general/63496/focus=63502>

Is there any good reason why Gnus uses coding systems of the form `foo'
rather than `foo-unix'?

This said, there's clearly a problem of backward compatibility since the
"buggy" code worked in Emacs-21.


        Stefan

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

* Re: problem with system_eol_type
  2006-07-31 16:30   ` Stefan Monnier
@ 2006-07-31 17:00     ` Jason Rumney
  2006-07-31 17:28       ` Eli Zaretskii
  2006-07-31 17:28     ` Eli Zaretskii
  2006-07-31 17:52     ` Stefan Monnier
  2 siblings, 1 reply; 17+ messages in thread
From: Jason Rumney @ 2006-07-31 17:00 UTC (permalink / raw)
  Cc: emacs-devel, mule-ja, Kenichi Handa

Stefan Monnier wrote:
> Is there any good reason why Gnus uses coding systems of the form `foo'
> rather than `foo-unix'?
>
> This said, there's clearly a problem of backward compatibility since the
> "buggy" code worked in Emacs-21.
>   

Gnus is released with Emacs, so this needn't be a concern if it is fixed 
in the Gnus source before release.

The question is, do any other packages rely on the default eol-type for 
encoding being Unix? For most uses, it shouldn't matter, it is only when 
encoding to a string rather than a file that there is a problem if I 
understand the Gnus case correctly.

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

* Re: problem with system_eol_type
  2006-07-31  6:04 problem with system_eol_type Kenichi Handa
  2006-07-31  9:46 ` Reiner Steib
@ 2006-07-31 17:27 ` Eli Zaretskii
  2006-07-31 22:16 ` Richard Stallman
  2 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2006-07-31 17:27 UTC (permalink / raw)
  Cc: mule-ja, emacs-devel

> From: Kenichi Handa <handa@m17n.org>
> Date: Mon, 31 Jul 2006 15:04:59 +0900
> Cc: mule-ja@m17n.org
> 
> But, the bug-reports say that there are many codes that
> assumes the previous behaviour, and some of them now don't
> work well on Windows.

What other packages, besides Gnus, were broken by this change?

> I think that it is cleaner to ask a program to specify the
> eol-type explicitly if it requires a specific eol-type on
> encoding.

I agree.

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

* Re: problem with system_eol_type
  2006-07-31 16:30   ` Stefan Monnier
  2006-07-31 17:00     ` Jason Rumney
@ 2006-07-31 17:28     ` Eli Zaretskii
  2006-07-31 17:52     ` Stefan Monnier
  2 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2006-07-31 17:28 UTC (permalink / raw)
  Cc: emacs-devel, mule-ja, handa

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Mon, 31 Jul 2006 12:30:26 -0400
> Cc: mule-ja@m17n.org, emacs-devel@gnu.org
> 
> I'd argue that those pieces of code had bugs: if your code depends on a Unix
> style EOL, it should say so explicitly.

100% agreement.

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

* Re: problem with system_eol_type
  2006-07-31 17:00     ` Jason Rumney
@ 2006-07-31 17:28       ` Eli Zaretskii
  0 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2006-07-31 17:28 UTC (permalink / raw)
  Cc: handa, mule-ja, emacs-devel

> Date: Mon, 31 Jul 2006 18:00:52 +0100
> From: Jason Rumney <jasonr@gnu.org>
> Cc: emacs-devel@gnu.org, mule-ja@m17n.org, Kenichi Handa <handa@m17n.org>
> 
> Stefan Monnier wrote:
> > Is there any good reason why Gnus uses coding systems of the form `foo'
> > rather than `foo-unix'?
> >
> > This said, there's clearly a problem of backward compatibility since the
> > "buggy" code worked in Emacs-21.
> >   
> 
> Gnus is released with Emacs, so this needn't be a concern if it is fixed 
> in the Gnus source before release.

Agreed.

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

* Re: problem with system_eol_type
  2006-07-31 16:30   ` Stefan Monnier
  2006-07-31 17:00     ` Jason Rumney
  2006-07-31 17:28     ` Eli Zaretskii
@ 2006-07-31 17:52     ` Stefan Monnier
  2 siblings, 0 replies; 17+ messages in thread
From: Stefan Monnier @ 2006-07-31 17:52 UTC (permalink / raw)
  Cc: mule-ja, emacs-devel

> Is there any good reason why Gnus uses coding systems of the form `foo'
> rather than `foo-unix'?

More to the point: is there any reason why any package should ever use
`raw-text' (rather than, say, `binary' aka `raw-text-unix')?


        Stefan

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

* Re: problem with system_eol_type
  2006-07-31  6:04 problem with system_eol_type Kenichi Handa
  2006-07-31  9:46 ` Reiner Steib
  2006-07-31 17:27 ` Eli Zaretskii
@ 2006-07-31 22:16 ` Richard Stallman
  2006-08-01  2:03   ` Katsumi Yamaoka
  2 siblings, 1 reply; 17+ messages in thread
From: Richard Stallman @ 2006-07-31 22:16 UTC (permalink / raw)
  Cc: mule-ja, emacs-devel

    Previously, when a coding system without explicit eol-type
    (e.g. iso-latin-1) was specified for encoding, Unix-like
    eol-type is selected on any platform.

    The change I made was to use an eol-type set to
    system_eol_type (CRLF on Windows, LF otherwise) in such a
    case.  To me, that change was just a bug fix.

This is clearly The Right Thing, at the user level.

    But, the bug-reports say that there are many codes that
    assumes the previous behaviour, and some of them now don't
    work well on Windows.

Thus, what's good at the UI level is not good at the API level.
Programs would usually like to get uniform results.

I see two possible approaches to this:

1. Fix those programs to specify `-unix'.  That way, they should get
LF eol behavior in all Emacs versions on all systems.

2. Take out your old change, and implement something at the UI level,
perhaps in a function that reads a coding system name.

#1 is clearly easier.  Is there any strong argument against it?


Is there a way 

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

* Re: problem with system_eol_type
  2006-07-31 22:16 ` Richard Stallman
@ 2006-08-01  2:03   ` Katsumi Yamaoka
  2006-08-01  3:19     ` Stefan Monnier
  2006-08-09 10:35     ` Katsumi Yamaoka
  0 siblings, 2 replies; 17+ messages in thread
From: Katsumi Yamaoka @ 2006-08-01  2:03 UTC (permalink / raw)
  Cc: mule-ja

;; Mule-ja people, you can read all the followups at:
;; http://news.gmane.org/group/gmane.emacs.devel/thread=57837/force_load=t

>>>>> In <E1G7g47-00074N-5S@fencepost.gnu.org> Richard Stallman wrote:

[...]

> I see two possible approaches to this:

> 1. Fix those programs to specify `-unix'.  That way, they should get
> LF eol behavior in all Emacs versions on all systems.

> 2. Take out your old change, and implement something at the UI level,
> perhaps in a function that reads a coding system name.

> #1 is clearly easier.  Is there any strong argument against it?

I think it is reasonable to use the eol which is system's
default when saving text files.  Since Gnus uses `raw-text' by
default to save files in many cases, mail files, for example,
are now saved with CRLF in DOS machines, otherwise with LF.  It
will be useful when other programs use those files.  So, I agree
to the recent behavior of Emacs but am negative to change Gnus'
default.

By the way, why is not CR used in Mac when specifying the coding
system `foo', not `foo-eol'?

Contrary to this argument concerning saving of files, I hope the
forms

(encode-coding-string "bar\n" 'foo)

and

(with-temp-buffer
  (insert "bar\n")
  (encode-coding-region (point-min) (point-max) 'foo)
  (buffer-string))

always return "bar\n" regardless of the system-type in the
future as well.

I don't have an idea how we should do when communicating with
processes.  Sorry.

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

* Re: problem with system_eol_type
  2006-08-01  2:03   ` Katsumi Yamaoka
@ 2006-08-01  3:19     ` Stefan Monnier
  2006-08-01  6:10       ` Katsumi Yamaoka
  2006-08-09 10:35     ` Katsumi Yamaoka
  1 sibling, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2006-08-01  3:19 UTC (permalink / raw)
  Cc: mule-ja, emacs-devel

> By the way, why is not CR used in Mac when specifying the coding
> system `foo', not `foo-eol'?

Only Mac OS 9 used CR-eol.  Mac OS X uses LF, like any other Unix variant.

> Contrary to this argument concerning saving of files, I hope the
> forms

> (encode-coding-string "bar\n" 'foo)

> and

> (with-temp-buffer
>   (insert "bar\n")
>   (encode-coding-region (point-min) (point-max) 'foo)
>   (buffer-string))

> always return "bar\n" regardless of the system-type in the
> future as well.

Why this discrepancy?


        Stefan

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

* Re: problem with system_eol_type
  2006-08-01  3:19     ` Stefan Monnier
@ 2006-08-01  6:10       ` Katsumi Yamaoka
  0 siblings, 0 replies; 17+ messages in thread
From: Katsumi Yamaoka @ 2006-08-01  6:10 UTC (permalink / raw)
  Cc: mule-ja

>>>>> In <jwvfyghi1od.fsf-monnier+emacs@gnu.org> Stefan Monnier wrote:

>> By the way, why is not CR used in Mac when specifying the coding
>> system `foo', not `foo-eol'?

> Only Mac OS 9 used CR-eol.  Mac OS X uses LF, like any other Unix variant.

Thanks.  It backs up the validity of the recent change in the
nnheader-insert-head function.

>> Contrary to this argument concerning saving of files, I hope the
>> forms

>> (encode-coding-string "bar\n" 'foo)

>> and

>> (with-temp-buffer
>>   (insert "bar\n")
>>   (encode-coding-region (point-min) (point-max) 'foo)
>>   (buffer-string))

>> always return "bar\n" regardless of the system-type in the
>> future as well.

> Why this discrepancy?

Because (at least) Gnus will need to be fixed here and there if
Emacs is changed so as to return "bar\r\n" or "bar\r" for those
forms.  For instance, if there are Latin-1 characters in a
message body, "bar\n" will be encoded by quoted-printable into
"bar=0D\n" or "bar=0D", which is not a good result.  I think it
is reasonable that LF is the default eol for strings and
buffer's contents since they are normally used internally in
Emacs.

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

* Re: problem with system_eol_type
  2006-08-01  2:03   ` Katsumi Yamaoka
  2006-08-01  3:19     ` Stefan Monnier
@ 2006-08-09 10:35     ` Katsumi Yamaoka
  2006-08-09 12:27       ` Stefan Monnier
  2006-08-10  1:13       ` Richard Stallman
  1 sibling, 2 replies; 17+ messages in thread
From: Katsumi Yamaoka @ 2006-08-09 10:35 UTC (permalink / raw)
  Cc: emacs-devel, mule-ja, semi-gnus-ja

;; To see the whole thread, please visit:
;; http://news.gmane.org/group/gmane.emacs.devel/thread=57837/force_load=t

>>>>> In <b4mbqr5xled.fsf@jpl.org> Katsumi Yamaoka wrote:

> I think it is reasonable to use the eol which is system's
> default when saving text files.  Since Gnus uses `raw-text' by
> default to save files in many cases, mail files, for example,
> are now saved with CRLF in DOS machines, otherwise with LF.  It
> will be useful when other programs use those files.  So, I agree
> to the recent behavior of Emacs but am negative to change Gnus'
> default.

[...]

> I don't have an idea how we should do when communicating with
> processes.  Sorry.

In relation to this, ARISAWA Akihiro reported that the compface.el
module bundled with Gnus doesn't work on Windows.  It is because
the line-break code is converted into CRLF by the recent Emacs 22
when communicating with processes, and at least the external
"icontopbm" program does not work with it.

I've fixed it in the Gnus trunk and the v5-10 branch so that
`coding-system-for-write' is bound to `raw-text-unix'.

Regards,


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

* Re: problem with system_eol_type
  2006-08-09 10:35     ` Katsumi Yamaoka
@ 2006-08-09 12:27       ` Stefan Monnier
  2006-08-09 22:07         ` Katsumi Yamaoka
  2006-08-10  1:13       ` Richard Stallman
  1 sibling, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2006-08-09 12:27 UTC (permalink / raw)
  Cc: ding, mule-ja, semi-gnus-ja, emacs-devel

> I've fixed it in the Gnus trunk and the v5-10 branch so that
> `coding-system-for-write' is bound to `raw-text-unix'.

Again, may I ask why you chose raw-text-unix rather than the more obviously
correct `binary'?


        Stefan


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

* Re: problem with system_eol_type
  2006-08-09 12:27       ` Stefan Monnier
@ 2006-08-09 22:07         ` Katsumi Yamaoka
  0 siblings, 0 replies; 17+ messages in thread
From: Katsumi Yamaoka @ 2006-08-09 22:07 UTC (permalink / raw)
  Cc: mule-ja, ding, semi-gnus-ja, emacs-devel

>>>>> Stefan Monnier wrote:

>> I've fixed it in the Gnus trunk and the v5-10 branch so that
>> `coding-system-for-write' is bound to `raw-text-unix'.

> Again, may I ask why you chose raw-text-unix rather than the more obviously
> correct `binary'?

There was no other purpose to have used raw-text-unix.  I've
changed it to binary now.  Thanks.

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

* Re: problem with system_eol_type
  2006-08-09 10:35     ` Katsumi Yamaoka
  2006-08-09 12:27       ` Stefan Monnier
@ 2006-08-10  1:13       ` Richard Stallman
  2006-08-10  7:35         ` Reiner Steib
  1 sibling, 1 reply; 17+ messages in thread
From: Richard Stallman @ 2006-08-10  1:13 UTC (permalink / raw)
  Cc: ding, mule-ja, semi-gnus-ja, emacs-devel

    In relation to this, ARISAWA Akihiro reported that the compface.el
    module bundled with Gnus doesn't work on Windows.  It is because
    the line-break code is converted into CRLF by the recent Emacs 22
    when communicating with processes, and at least the external
    "icontopbm" program does not work with it.

    I've fixed it in the Gnus trunk and the v5-10 branch so that
    `coding-system-for-write' is bound to `raw-text-unix'.

Whatever the right fix is, can you fix it in the Emacs repository too,
please?


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

* Re: problem with system_eol_type
  2006-08-10  1:13       ` Richard Stallman
@ 2006-08-10  7:35         ` Reiner Steib
  0 siblings, 0 replies; 17+ messages in thread
From: Reiner Steib @ 2006-08-10  7:35 UTC (permalink / raw)
  Cc: ding, emacs-devel

On Thu, Aug 10 2006, Richard Stallman wrote:

>     I've fixed it in the Gnus trunk and the v5-10 branch so that
>     `coding-system-for-write' is bound to `raw-text-unix'.
>
> Whatever the right fix is, can you fix it in the Emacs repository too,
> please?

Changes from the stable Gnus branch (v5-10) are (semi-) automatically
propagated to the Emacs repository by Miles Bader (using his arch
repositories).  Usually the delay is only a few days.  (Similar for
the other direction.)

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



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

end of thread, other threads:[~2006-08-10  7:35 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31  6:04 problem with system_eol_type Kenichi Handa
2006-07-31  9:46 ` Reiner Steib
2006-07-31 16:30   ` Stefan Monnier
2006-07-31 17:00     ` Jason Rumney
2006-07-31 17:28       ` Eli Zaretskii
2006-07-31 17:28     ` Eli Zaretskii
2006-07-31 17:52     ` Stefan Monnier
2006-07-31 17:27 ` Eli Zaretskii
2006-07-31 22:16 ` Richard Stallman
2006-08-01  2:03   ` Katsumi Yamaoka
2006-08-01  3:19     ` Stefan Monnier
2006-08-01  6:10       ` Katsumi Yamaoka
2006-08-09 10:35     ` Katsumi Yamaoka
2006-08-09 12:27       ` Stefan Monnier
2006-08-09 22:07         ` Katsumi Yamaoka
2006-08-10  1:13       ` Richard Stallman
2006-08-10  7:35         ` Reiner Steib

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