changeset 62291:461736030d14

(mac-select-convert-to-string): Try coding systems in mac-script-code-coding-systems if specified one cannot encode string for `com.apple.traditional-mac-plain-text'.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Fri, 13 May 2005 08:51:35 +0000
parents 19e0ad492c07
children 3c46f9593ea1
files lisp/term/mac-win.el
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/term/mac-win.el	Fri May 13 08:50:27 2005 +0000
+++ b/lisp/term/mac-win.el	Fri May 13 08:51:35 2005 +0000
@@ -1328,6 +1328,13 @@
 			 coding 'utf-16)))
 	      (setq str (or s (encode-coding-string str 'utf-16-mac)))))
 	   ((eq type 'com.apple.traditional-mac-plain-text)
+	    (let ((encodables (find-coding-systems-string str))
+		  (rest mac-script-code-coding-systems))
+	      (unless (memq coding encodables)
+		(while (and rest (not (memq (cdar rest) encodables)))
+		  (setq rest (cdr rest)))
+		(if rest
+		    (setq coding (cdar rest)))))
 	    (setq coding (coding-system-change-eol-conversion coding 'mac))
 	    (setq str (encode-coding-string str coding)))
 	   (t