diff lisp/files.el @ 50093:d3fb3e2b1782

(insert-directory): Decode by what specified.
author Kenichi Handa <handa@m17n.org>
date Wed, 12 Mar 2003 08:02:32 +0000
parents e3891cc6c667
children ad28e7a35442
line wrap: on
line diff
--- a/lisp/files.el	Wed Mar 12 08:02:15 2003 +0000
+++ b/lisp/files.el	Wed Mar 12 08:02:32 2003 +0000
@@ -4125,21 +4125,31 @@
 	      (delete-region (point) (progn (forward-line 2) (point)))))
 
 	  ;; Now decode what read if necessary.
-	  (let ((coding (or coding-system-for-write
-			    (detect-coding-region beg (point) t)))
+	  (let ((coding (or coding-system-for-read
+			    file-name-coding-system
+			    default-file-name-coding-system
+			    'undecided))
 		val pos)
-	    (if (not (eq (coding-system-base coding) 'undecided))
-		(save-restriction
-		  (narrow-to-region beg (point))
-		  (goto-char (point-min))
-		  (while (not (eobp))
-		    (setq pos (point)
-			  val (get-text-property (point) 'dired-filename))
-		    (goto-char (next-single-property-change
-				(point) 'dired-filename nil (point-max)))
-		    (decode-coding-region pos (point) coding)
-		    (if val
-			(put-text-property pos (point) 'dired-filename t))))))
+	    (when (and enable-multibyte-characters
+		       (not (memq (coding-system-base coding)
+				  '(raw-text no-conversion))))
+	      ;; If no coding system is specified or detection is
+	      ;; requested, detect the coding.
+	      (if (eq (coding-system-base coding) 'undecided)
+		  (setq coding (detect-coding-region beg (point) t)))
+	      (if (not (eq (coding-system-base coding) 'undecided))
+		  (save-restriction
+		    (narrow-to-region beg (point))
+		    (goto-char (point-min))
+		    (while (not (eobp))
+		      (setq pos (point)
+			    val (get-text-property (point) 'dired-filename))
+		      (goto-char (next-single-property-change
+				  (point) 'dired-filename nil (point-max)))
+		      (decode-coding-region pos (point) coding)
+		      (if val
+			  (put-text-property pos (point)
+					     'dired-filename t)))))))
 
 	  (if full-directory-p
 	      ;; Try to insert the amount of free space.