diff lisp/files.el @ 51187:3df081c84ab6

(insert-directory): Preserve CR in a file name.
author Andreas Schwab <schwab@suse.de>
date Sat, 24 May 2003 20:16:33 +0000
parents d80aece92b78
children f827a37d5c82
line wrap: on
line diff
--- a/lisp/files.el	Sat May 24 20:11:55 2003 +0000
+++ b/lisp/files.el	Sat May 24 20:16:33 2003 +0000
@@ -4304,6 +4304,7 @@
 			    file-name-coding-system
 			    default-file-name-coding-system
 			    'undecided))
+		coding-no-eol
 		val pos)
 	    (when (and enable-multibyte-characters
 		       (not (memq (coding-system-base coding)
@@ -4314,6 +4315,8 @@
 		  (setq coding (detect-coding-region beg (point) t)))
 	      (if (not (eq (coding-system-base coding) 'undecided))
 		  (save-restriction
+		    (setq coding-no-eol
+			  (coding-system-change-eol-conversion coding 'unix))
 		    (narrow-to-region beg (point))
 		    (goto-char (point-min))
 		    (while (not (eobp))
@@ -4321,7 +4324,10 @@
 			    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)
+		      ;; Force no eol conversion on a file name, so
+		      ;; that CR is preserved.
+		      (decode-coding-region pos (point)
+					    (if val coding-no-eol coding))
 		      (if val
 			  (put-text-property pos (point)
 					     'dired-filename t)))))))