changeset 21050:13e905e1d33c

Include charset.h and coding.h. (ENCODE_FILE): This macro is moved to coding.h. (Vdefault_file_name_coding_system): Extern it. (Fdirectory_files): Use DECODE_FILE. (file_name_completion): Likewise.
author Kenichi Handa <handa@m17n.org>
date Tue, 03 Mar 1998 07:18:46 +0000
parents 01e626b0a624
children b5844e2bf088
files src/dired.c
diffstat 1 files changed, 8 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/dired.c	Tue Mar 03 07:18:46 1998 +0000
+++ b/src/dired.c	Tue Mar 03 07:18:46 1998 +0000
@@ -78,7 +78,8 @@
 #include "lisp.h"
 #include "buffer.h"
 #include "commands.h"
-
+#include "charset.h"
+#include "coding.h"
 #include "regex.h"
 
 /* Returns a search buffer, with a fastmap allocated and ready to go.  */
@@ -86,14 +87,6 @@
 
 #define min(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)
-
 /* if system does not have symbolic links, it does not have lstat.
    In that case, use ordinary stat instead.  */
 
@@ -103,7 +96,7 @@
 
 extern int completion_ignore_case;
 extern Lisp_Object Vcompletion_regexp_list;
-extern Lisp_Object Vfile_name_coding_system;
+extern Lisp_Object Vfile_name_coding_system, Vdefault_file_name_coding_system;
 
 Lisp_Object Vcompletion_ignored_extensions;
 Lisp_Object Qcompletion_ignore_case;
@@ -231,9 +224,7 @@
 		}
 	      else
 		name = make_string (dp->d_name, len);
-	      if (! NILP (Vfile_name_coding_system))
-		name = Fdecode_coding_string (name, Vfile_name_coding_system,
-					      Qt);
+	      name = DECODE_FILE (name);
 	      list = Fcons (name, list);
 	    }
 	}
@@ -462,9 +453,7 @@
 		name = make_string (dp->d_name, len);
 	      if (all_flag)
 		{
-		  if (! NILP (Vfile_name_coding_system))
-		    name = Fdecode_coding_string (name,
-						  Vfile_name_coding_system, Qt);
+		  name = DECODE_FILE (name);
 		  bestmatch = Fcons (name, bestmatch);
 		}
 	      else
@@ -532,10 +521,8 @@
 
   if (all_flag || NILP (bestmatch))
     {
-      if (! NILP (Vfile_name_coding_system)
-	  && STRINGP (bestmatch))
-	bestmatch = Fdecode_coding_string (bestmatch,
-					   Vfile_name_coding_system, Qt);
+      if (STRINGP (bestmatch))
+	bestmatch = DECODE_FILE (bestmatch);
       return bestmatch;
     }
   if (matchcount == 1 && bestmatchsize == XSTRING (file)->size)
@@ -544,9 +531,7 @@
 			  make_number (bestmatchsize));
   /* Now that we got the right initial segment of BESTMATCH,
      decode it from the coding system in use.  */
-  if (! NILP (Vfile_name_coding_system))
-    bestmatch = Fdecode_coding_string (bestmatch,
-				       Vfile_name_coding_system, Qt);
+  bestmatch = DECODE_FILE (bestmatch);
   return bestmatch;
 
  quit: