[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

[MD:773]file-name-coding-system in call-process



後藤@太陽計測です

某MLで発生したエラーで発覚したのですが、call-processのINFILEに漢字の
ファイル名を指定すると"no such file or directory"となります。
openの際にfile-name-coding-systemに変換していないのが原因と考えられ
たので、以下のようなパッチを作成してみました。
WinNT4+SP1 環境では試してみました。
どんなもんでしょう。

;; emacs-20.3以降ではどうなってるのかは確認していません。

--- Regards,
 Shun-ichi Goto  <gotoh@xxxxxxxxxxx>
   R&D Group, TAIYO Corp., Tokyo, JAPAN
*** callproc.c.orig	Wed Jan 14 21:42:19 1998
--- callproc.c	Fri Jul 03 12:28:25 1998
***************
*** 86,91 ****
--- 86,99 ----
  
  #define max(a, b) ((a) > (b) ? (a) : (b))
  
+ /* Encode the file name NAME using the specified coding system
+    for file names, if any.  */
+ #define ENCODE_FILE(name)					\
+   (! NILP (Vfile_name_coding_system)				\
+    && XFASTINT (Vfile_name_coding_system) != 0			\
+    ? Fencode_coding_string (name, Vfile_name_coding_system, Qt)	\
+    : name)
+ 
  #ifdef DOS_NT
  /* When we are starting external processes we need to know whether they
     take binary input (no conversion) or text input (\n is converted to
***************
*** 399,405 ****
  
    display = nargs >= 4 ? args[3] : Qnil;
  
!   filefd = open (XSTRING (infile)->data, O_RDONLY, 0);
    if (filefd < 0)
      {
        report_file_error ("Opening process input file", Fcons (infile, Qnil));
--- 407,418 ----
  
    display = nargs >= 4 ? args[3] : Qnil;
  
!   /* open INFILE with file-name-coding-system */
!   {
!     Lisp_Object fn;
!     fn = ENCODE_FILE(infile);
!     filefd = open (XSTRING (fn)->data, O_RDONLY, 0);
!   }
    if (filefd < 0)
      {
        report_file_error ("Opening process input file", Fcons (infile, Qnil));