]> git.eshelyaron.com Git - emacs.git/commitdiff
(mac-select-convert-to-string): Try coding
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Fri, 13 May 2005 08:51:35 +0000 (08:51 +0000)
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Fri, 13 May 2005 08:51:35 +0000 (08:51 +0000)
systems in mac-script-code-coding-systems if specified one cannot
encode string for `com.apple.traditional-mac-plain-text'.

lisp/term/mac-win.el

index 8fbbc7cd41a0483717beaf18f8eeb176ddee9971..366668c66f3bfb5ac5626beb1cca1f0a0b540003 100644 (file)
@@ -1328,6 +1328,13 @@ in `selection-converter-alist', which see."
                         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