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

[MD:1849] buffer-file-coding-sytem for empty buffer



;; meadow-develop にも。

>>>>> meadow-users-jp の No. 2634
>>>>> Message-Id: <u4s2upcfj.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> で、
>>>>> "himi" == MIYASHITA Hisashi(宮下 尚:HIMI) <himi@xxxxxxxxxxxxxxxxxxxxxxxxx>さま曰く...

himi> yagi@xxxxxxxxxxxxxxx writes:
>> meadow-1.13b1, emacs-20.6 です。
>> 
>> find-file-not-found-hooks
>> => (vc-file-not-found-hook
>> find-file-not-found-set-buffer-file-coding-system)
>> ですが、find-file-not-found-set-buffer-file-coding-system は
>> dos-w32.el で定義・add-hook されているので
>> Unix 上では問題無いかもしれません。
>> (remove-hook してみたら、うまくいった。)

himi> げーーん。そういう話ですか。

himi> はい。分かりました。余裕が出来たら調べます。 > ごめんなさい。半田さん。

こんな patch でよろしいでしょうか?
--- dos-w32.el.orig	Tue Apr 11 21:11:14 2000
+++ dos-w32.el	Tue Oct  3 17:27:36 2000
@@ -129,36 +129,40 @@
 	(binary nil) (text nil)
 	(undecided nil) (undecided-unix nil))
     (cond ((eq op 'insert-file-contents) 
-	   (setq target (nth 1 command))
-	   ;; First check for a file name that indicates
-	   ;; it is truly binary.
-	   (setq binary (find-buffer-file-type target))
-	   (cond (binary)
-		 ;; Next check for files that MUST use DOS eol conversion.
-		 ((find-buffer-file-type-match target)
-		  (setq text t))
-		 ;; For any other existing file, decide based on contents.
-		 ((file-exists-p target)
-		  (setq undecided t))
-		 ;; Next check for a non-DOS file system.
-		 ((untranslated-file-p target)
-		  (setq undecided-unix t)))
-	   (cond (binary '(no-conversion . no-conversion))
-		 (text '(undecided-dos . undecided-dos))
-		 (undecided-unix '(undecided-unix . undecided-unix))
-		 (undecided '(undecided . undecided))
-		 (t (cons default-buffer-file-coding-system
-			  default-buffer-file-coding-system))))
+	   (if coding-system-for-read
+	       (cons coding-system-for-read coding-system-for-read)
+	     (setq target (nth 1 command))
+	     ;; First check for a file name that indicates
+	     ;; it is truly binary.
+	     (setq binary (find-buffer-file-type target))
+	     (cond (binary)
+		   ;; Next check for files that MUST use DOS eol conversion.
+		   ((find-buffer-file-type-match target)
+		    (setq text t))
+		   ;; For any other existing file, decide based on contents.
+		   ((file-exists-p target)
+		    (setq undecided t))
+		   ;; Next check for a non-DOS file system.
+		   ((untranslated-file-p target)
+		    (setq undecided-unix t)))
+	     (cond (binary '(no-conversion . no-conversion))
+		   (text '(undecided-dos . undecided-dos))
+		   (undecided-unix '(undecided-unix . undecided-unix))
+		   (undecided '(undecided . undecided))
+		   (t (cons default-buffer-file-coding-system
+			    default-buffer-file-coding-system)))))
 	  ((eq op 'write-region)
-	   (if buffer-file-coding-system
-	       (cons buffer-file-coding-system
-		     buffer-file-coding-system)
-	     ;; Normally this is used only in a non-file-visiting
-	     ;; buffer, because normally buffer-file-coding-system is non-nil
-	     ;; in a file-visiting buffer.
-	     (if buffer-file-type
-		 '(no-conversion . no-conversion)
-	       '(undecided-dos . undecided-dos)))))))
+	   (if coding-system-for-write
+	       (cons coding-system-for-write coding-system-for-write)
+	     (if buffer-file-coding-system
+		 (cons buffer-file-coding-system
+		       buffer-file-coding-system)
+	       ;; Normally this is used only in a non-file-visiting
+	       ;; buffer, because normally buffer-file-coding-system is non-nil
+	       ;; in a file-visiting buffer.
+	       (if buffer-file-type
+		   '(no-conversion . no-conversion)
+		 '(undecided-dos . undecided-dos))))))))
 
 (or (featurep 'meadow)
     (modify-coding-system-alist 'file "" 'find-buffer-file-type-coding-system))
-- 
鈴木圭一 / keiichi@xxxxxxxxx
PGP finger print (DH/DSS)
0B32 B37E 6DE9 3BC1 68A4  4089 7AAF 2B03 ECBD 614B