changeset 89661:e4d881b2d51c

(select-safe-coding-system): Fix for the case that the first element of default-coding-system is t. Fix a message when some coding systems are rejected.
author Kenichi Handa <handa@m17n.org>
date Tue, 25 Nov 2003 13:03:14 +0000
parents e43b36fafd30
children 40ab87d553df
files lisp/international/mule-cmds.el
diffstat 1 files changed, 14 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule-cmds.el	Tue Nov 25 08:07:54 2003 +0000
+++ b/lisp/international/mule-cmds.el	Tue Nov 25 13:03:14 2003 +0000
@@ -702,22 +702,20 @@
 	(coding-system nil)
 	(bufname (buffer-name))
 	safe rejected unsafe)
-    (if (eq (car codings) 'undecided)
-	;; Any coding system is ok.
-	(setq coding-system t)
-      ;; Classify the defaults into safe, rejected, and unsafe.
-      (dolist (elt default-coding-system)
-	(if (memq (cdr elt) codings)
-	    (if (and (functionp accept-default-p)
-		     (not (funcall accept-default-p (cdr elt))))
-		(push (car elt) rejected)
-	      (push (car elt) safe))
-	  (push (car elt) unsafe)))
-      (if safe
-	  (setq coding-system (car safe))))
+    ;; Classify the defaults into safe, rejected, and unsafe.
+    (dolist (elt default-coding-system)
+      (if (or (eq (car codings) 'undecided)
+	      (memq (cdr elt) codings))
+	  (if (and (functionp accept-default-p)
+		   (not (funcall accept-default-p (cdr elt))))
+	      (push (car elt) rejected)
+	    (push (car elt) safe))
+	(push (car elt) unsafe)))
+    (if safe
+	(setq coding-system (car safe)))
 
     ;; If all the defaults failed, ask a user.
-    (when (not coding-system)
+    (unless coding-system
       ;; At first, if some defaults are unsafe, record at most 11
       ;; problematic characters and their positions for them by turning
       ;;	(CODING ...)
@@ -860,7 +858,7 @@
 The first problematic character is at point in the displayed buffer,\n"
 			  (substitute-command-keys "\
 and \\[universal-argument] \\[what-cursor-position] will give information about it.\n"))))
-	      (insert (if safe
+	      (insert (if rejected
 			  "\nSelect the above, or "
 			"\nSelect ")
 		      "\
@@ -886,14 +884,12 @@
 	(kill-buffer "*Warning*")
 	(set-window-configuration window-configuration)))
 
-    (if (vectorp (coding-system-eol-type coding-system))
+    (if (and coding-system (vectorp (coding-system-eol-type coding-system)))
 	(let ((eol (coding-system-eol-type buffer-file-coding-system)))
 	  (if (numberp eol)
 	      (setq coding-system
 		    (coding-system-change-eol-conversion coding-system eol)))))
 
-    (if (eq coding-system t)
-	(setq coding-system buffer-file-coding-system))
     ;; Check we're not inconsistent with what `coding:' spec &c would
     ;; give when file is re-read.
     ;; But don't do this if we explicitly ignored the cookie