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

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

Re: Carbon Emacs won't start when installed in certain paths


From: YAMAMOTO Mitsuharu
Subject: Re: Carbon Emacs won't start when installed in certain paths
Date: Wed, 11 Apr 2007 10:35:13 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.0.97 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Tue, 10 Apr 2007 10:36:08 -0400, Stefan Monnier <address@hidden> said:

>> +   /* At this moment, we still don't know how to decode the directory
>> +      name.  So, we keep the bytes in multibyte form so that
>> +      ENCODE_FILE correctly gets the original bytes.  */
>> Vdata_directory
>> !     = Ffile_name_as_directory (string_to_multibyte
>> !                           (make_unibyte_string (data_dir,
>> !                                                 strlen (data_dir))));
>> Vdoc_directory
>> !     = Ffile_name_as_directory (string_to_multibyte
>> !                           (make_unibyte_string (doc_dir,
>> !                                                 strlen (doc_dir))));

> Why not just keep it in unibyte form?
  
Because the current ENCODE_FILE seems to assume that file name strings
are in multibyte or ASCII-only unibyte.  Also, the initialization of
current_buffer->directory in init_buffer (buffer.c) does the same
thing.

If we allow non-ASCII unibyte strings for file names, maybe we need to
change ENCODE_FILE and Fexpand_file_name as below, and rule out the
use of concat in favor of expand-file-name to avoid implicit
string-make-multibyte for non-ASCII bytes.

By the way, I noticed that current_buffer->directory mentioned above
is decoded with local-coding-system in command-line (startup.el) after
coding systems are ready.  Why not (default-)file-name-coding-system?

  ;; Decode all default-directory.
  (if (and default-enable-multibyte-characters locale-coding-system)
      (save-excursion
        (dolist (elt (buffer-list))
          (set-buffer elt)
          (if default-directory
              (setq default-directory
                    (decode-coding-string default-directory
                                          locale-coding-system t))))
        (setq command-line-default-directory
              (decode-coding-string command-line-default-directory
                                    locale-coding-system t))))

                                     YAMAMOTO Mitsuharu
                                address@hidden

Index: src/buffer.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/buffer.c,v
retrieving revision 1.525
diff -c -p -r1.525 buffer.c
*** src/buffer.c        29 Mar 2007 15:58:34 -0000      1.525
--- src/buffer.c        11 Apr 2007 00:54:42 -0000
*************** init_buffer ()
*** 5211,5222 ****
  #endif /* not VMS */
  
    current_buffer->directory = make_unibyte_string (pwd, strlen (pwd));
-   if (! NILP (buffer_defaults.enable_multibyte_characters))
-     /* At this moment, we still don't know how to decode the
-        directory name.  So, we keep the bytes in multibyte form so
-        that ENCODE_FILE correctly gets the original bytes.  */
-     current_buffer->directory
-       = string_to_multibyte (current_buffer->directory);
  
    /* Add /: to the front of the name
       if it would otherwise be treated as magic.  */
--- 5211,5216 ----
Index: src/callproc.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/callproc.c,v
retrieving revision 1.221
diff -c -p -r1.221 callproc.c
*** src/callproc.c      17 Feb 2007 01:59:00 -0000      1.221
--- src/callproc.c      11 Apr 2007 00:54:42 -0000
*************** init_callproc_1 ()
*** 1522,1533 ****
    char *data_dir = egetenv ("EMACSDATA");
    char *doc_dir = egetenv ("EMACSDOC");
  
    Vdata_directory
!     = Ffile_name_as_directory (build_string (data_dir ? data_dir
!                                            : PATH_DATA));
    Vdoc_directory
!     = Ffile_name_as_directory (build_string (doc_dir ? doc_dir
!                                            : PATH_DOC));
  
    /* Check the EMACSPATH environment variable, defaulting to the
       PATH_EXEC path from epaths.h.  */
--- 1522,1536 ----
    char *data_dir = egetenv ("EMACSDATA");
    char *doc_dir = egetenv ("EMACSDOC");
  
+   if (!data_dir) data_dir = PATH_DATA;
+   if (!doc_dir) doc_dir = PATH_DOC;
+ 
    Vdata_directory
!     = Ffile_name_as_directory (make_unibyte_string (data_dir,
!                                                   strlen (data_dir)));
    Vdoc_directory
!     = Ffile_name_as_directory (make_unibyte_string (doc_dir,
!                                                   strlen (doc_dir)));
  
    /* Check the EMACSPATH environment variable, defaulting to the
       PATH_EXEC path from epaths.h.  */
Index: src/coding.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/coding.h,v
retrieving revision 1.83
diff -c -p -r1.83 coding.h
*** src/coding.h        21 Jan 2007 20:49:26 -0000      1.83
--- src/coding.h        11 Apr 2007 00:54:42 -0000
*************** struct coding_system
*** 580,592 ****
  /* Encode the file name NAME using the specified coding system
     for file names, if any.  */
  #define ENCODE_FILE(name)                                                \
!   (! NILP (Vfile_name_coding_system)                                     \
!    && !EQ (Vfile_name_coding_system, make_number (0))                    \
!    ? code_convert_string_norecord (name, Vfile_name_coding_system, 1)    \
!    : (! NILP (Vdefault_file_name_coding_system)                               
   \
!       && !EQ (Vdefault_file_name_coding_system, make_number (0))         \
!       ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 
1) \
!       : name))
  
  /* Decode the file name NAME using the specified coding system
     for file names, if any.  */
--- 580,594 ----
  /* Encode the file name NAME using the specified coding system
     for file names, if any.  */
  #define ENCODE_FILE(name)                                                \
!   (!STRING_MULTIBYTE (name)                                              \
!    ? (name)                                                              \
!    : (! NILP (Vfile_name_coding_system)                                       
\
!       && !EQ (Vfile_name_coding_system, make_number (0))                 \
!       ? code_convert_string_norecord (name, Vfile_name_coding_system, 1)   \
!       : (! NILP (Vdefault_file_name_coding_system)                       \
!        && !EQ (Vdefault_file_name_coding_system, make_number (0))        \
!        ? code_convert_string_norecord (name, 
Vdefault_file_name_coding_system, 1) \
!        : name)))
  
  /* Decode the file name NAME using the specified coding system
     for file names, if any.  */
Index: src/emacs.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/emacs.c,v
retrieving revision 1.401
diff -c -p -r1.401 emacs.c
*** src/emacs.c 3 Apr 2007 15:25:28 -0000       1.401
--- src/emacs.c 11 Apr 2007 00:54:42 -0000
*************** decode_env_path (evarname, defalt)
*** 2379,2385 ****
      {
        p = index (path, SEPCHAR);
        if (!p) p = path + strlen (path);
!       element = (p - path ? make_string (path, p - path)
                 : build_string ("."));
  
        /* Add /: to the front of the name
--- 2379,2385 ----
      {
        p = index (path, SEPCHAR);
        if (!p) p = path + strlen (path);
!       element = (p - path ? make_unibyte_string (path, p - path)
                 : build_string ("."));
  
        /* Add /: to the front of the name
Index: src/fileio.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fileio.c,v
retrieving revision 1.580
diff -c -p -r1.580 fileio.c
*** src/fileio.c        22 Mar 2007 12:15:04 -0000      1.580
--- src/fileio.c        11 Apr 2007 00:54:42 -0000
*************** See also the function `substitute-in-fil
*** 1448,1454 ****
  #endif
        && !newdir)
      {
!       newdir = SDATA (default_directory);
        multibyte |= STRING_MULTIBYTE (default_directory);
  #ifdef DOS_NT
        /* Note if special escape prefix is present, but remove for now.  */
--- 1448,1456 ----
  #endif
        && !newdir)
      {
!       newdir = (multibyte
!               ? SDATA (string_to_multibyte (default_directory))
!               : SDATA (default_directory));
        multibyte |= STRING_MULTIBYTE (default_directory);
  #ifdef DOS_NT
        /* Note if special escape prefix is present, but remove for now.  */
Index: src/lread.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/lread.c,v
retrieving revision 1.369
diff -c -p -r1.369 lread.c
*** src/lread.c 28 Mar 2007 08:16:19 -0000      1.369
--- src/lread.c 11 Apr 2007 00:54:42 -0000
*************** openp (path, str, suffixes, storeptr, pr
*** 1234,1240 ****
                  handler = Ffind_file_name_handler (filename, Qfile_exists_p);
             It's not clear why that was the case and it breaks things like
             (load "/bar.el") where the file is actually "/bar.el.gz".  */
!         string = build_string (fn);
          handler = Ffind_file_name_handler (string, Qfile_exists_p);
          if ((!NILP (handler) || !NILP (predicate)) && !NATNUMP (predicate))
              {
--- 1234,1241 ----
                  handler = Ffind_file_name_handler (filename, Qfile_exists_p);
             It's not clear why that was the case and it breaks things like
             (load "/bar.el") where the file is actually "/bar.el.gz".  */
!         string = make_specified_string (fn, -1, strlen (fn),
!                                         STRING_MULTIBYTE (filename));
          handler = Ffind_file_name_handler (string, Qfile_exists_p);
          if ((!NILP (handler) || !NILP (predicate)) && !NATNUMP (predicate))
              {




reply via email to

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