emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrong type argument: arrayp, nil with LANG=C under Windows


From: Kenichi Handa
Subject: Re: Wrong type argument: arrayp, nil with LANG=C under Windows
Date: Wed, 12 Apr 2006 14:53:04 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

In article <address@hidden>, Eli Zaretskii <address@hidden> writes:

> However, the behavior of Emacs on non-Posix platforms under LANG=C
> raises a subtle issue.  Right now, when LANG=C (or Posix),
> set-locale-environment sets up things so that the default
> buffer-file-coding-system is reset to nil, and that causes Emacs to
> create files with Unix-style EOL conversion.  This happens because the
> "C" language is mapped to "ASCII", which specifies no encoding.  Thus,
> set-language-environment resets the default coding systems to nil, and
> leaves it at that.  Then the code which takes care of copying the EOL
> conversion from previous defaults doesn't do its thing.

> The question is, is this a bug or a feature?  That is, is it right for
> Emacs on MS-Windows to create Unix-style text files under LANG=C?  I
> tend to think it's a bug, but I'm not sure.

I agree that it's a bug.

> (For that matter, what does it mean for buffer-file-coding-system to
> be nil?)

If buffer-file-coding-system is nil, and some other file is
inserted with decoding, the buffer-file-coding-system is
changed to the coding-system used for that decoding.

If buffer-file-coding-system is dos, and some other file is
inserted with decoding, the buffer-file-coding-system is
changed to XXX-dos where, XXX part is the text-encoding part
of the coding-system used for that decoding.

And, on writing, coding-system is nil, it is treated as
raw-text-unix.  I've just installed the attached change to
make it system-dependent; i.e. on Windows, nil is treated as
raw-text-dos.  FYI, system_eol_type is set as this (in
init_coding_once):

#if defined (MSDOS) || defined (WINDOWSNT)
  system_eol_type = CODING_EOL_CRLF;
#else
  system_eol_type = CODING_EOL_LF;
#endif

What do you think?

---
Kenichi Handa
address@hidden

Index: coding.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/coding.c,v
retrieving revision 1.330
retrieving revision 1.331
diff -u -r1.330 -r1.331
--- coding.c    9 Mar 2006 12:20:57 -0000       1.330
+++ coding.c    12 Apr 2006 05:47:20 -0000      1.331
@@ -3621,7 +3621,7 @@
        = CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
     }
   else
-    coding->eol_type = CODING_EOL_LF;
+    coding->eol_type = system_eol_type;
 
   coding_type = XVECTOR (coding_spec)->contents[0];
   /* Try short cut.  */
@@ -3922,7 +3922,7 @@
   coding->type = coding_type_no_conversion;
   coding->category_idx = CODING_CATEGORY_IDX_BINARY;
   coding->common_flags = 0;
-  coding->eol_type = CODING_EOL_LF;
+  coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF;
   coding->pre_write_conversion = coding->post_read_conversion = Qnil;
   return -1;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]