changeset 90212:76ab0b868ab0

(coding-system-get): Check `ascii-incompatible' for backward compatiblity. (set-file-name-coding-system): Signal an error for a coding system not suitable for file name. (set-keyboard-coding-system): Signal an error for a coding system not suitable for keyboard.
author Kenichi Handa <handa@m17n.org>
date Fri, 29 Jul 2005 06:17:39 +0000
parents efcbeb957a31
children 90706d6433c9
files lisp/international/mule.el
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule.el	Fri Jul 29 06:15:24 2005 +0000
+++ b/lisp/international/mule.el	Fri Jul 29 06:17:39 2005 +0000
@@ -842,8 +842,12 @@
 like `mime-charset' as well as the current style like `:mime-charset'."
   (or (plist-get (coding-system-plist coding-system) prop)
       (if (not (keywordp prop))
-	  (plist-get (coding-system-plist coding-system)
-		     (intern (concat ":" (symbol-name prop)))))))
+	  ;; For backward compatiblity.
+	  (if (eq prop 'ascii-incompatible)
+	      (not (plist-get (coding-system-plist coding-system)
+			      :ascii-compatible-p))
+	    (plist-get (coding-system-plist coding-system)
+		       (intern (concat ":" (symbol-name prop))))))))
 
 (defun coding-system-eol-type-mnemonic (coding-system)
   "Return the string indicating end-of-line format of CODING-SYSTEM."
@@ -1173,6 +1177,10 @@
 see) to CODING-SYSTEM."
   (interactive "zCoding system for file names (default, nil): ")
   (check-coding-system coding-system)
+  (if (and coding-system
+	   (not (coding-system-get coding-system :ascii-compatible-p))
+	   (not (coding-system-get coding-system :suitable-for-file-name)))
+      (error "%s is not suitable for file names" coding-system))
   (setq file-name-coding-system coding-system))
 
 (defvar default-terminal-coding-system nil
@@ -1229,6 +1237,10 @@
       (setq coding-system default-keyboard-coding-system))
   (if coding-system
       (setq default-keyboard-coding-system coding-system))
+  (if (and coding-system
+	   (not (coding-system-get coding-system :ascii-compatible-p))
+	   (not (coding-system-get coding-system :suitable-for-keyboard)))
+      (error "%s is not suitable for keyboard" coding-system))
   (set-keyboard-coding-system-internal coding-system)
   (setq keyboard-coding-system coding-system)
   (encoded-kbd-mode (if coding-system 1 0)))