diff options
| author | YAMAMOTO Mitsuharu | 2005-10-16 02:21:16 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2005-10-16 02:21:16 +0000 |
| commit | 02abe13c74d269e5892377330d7284b3138e9d6a (patch) | |
| tree | d1b862145cd04d22fe31444d6b931f53ec3932fa | |
| parent | cb23c7c11c38309b4964c576bc3999afa77f1162 (diff) | |
| download | emacs-02abe13c74d269e5892377330d7284b3138e9d6a.tar.gz emacs-02abe13c74d269e5892377330d7284b3138e9d6a.zip | |
Apply 2005-10-09 change for term/x-win.el.
(x-get-selection, mac-select-convert-to-string): Convert from/to
UTF-16 clipboard data as in native byte order, no BOM.
| -rw-r--r-- | lisp/term/mac-win.el | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index 607a497c0ca..88d6ef7da2c 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el | |||
| @@ -54,8 +54,6 @@ | |||
| 54 | ;; -font *font | 54 | ;; -font *font |
| 55 | ;; -foreground *foreground | 55 | ;; -foreground *foreground |
| 56 | ;; -geometry .geometry | 56 | ;; -geometry .geometry |
| 57 | ;; -i .iconType | ||
| 58 | ;; -itype .iconType | ||
| 59 | ;; -iconic .iconic | 57 | ;; -iconic .iconic |
| 60 | ;; -name .name | 58 | ;; -name .name |
| 61 | ;; -reverse *reverseVideo | 59 | ;; -reverse *reverseVideo |
| @@ -1198,15 +1196,21 @@ in `selection-converter-alist', which see." | |||
| 1198 | (when (and (stringp data) | 1196 | (when (and (stringp data) |
| 1199 | (setq data-type (get-text-property 0 'foreign-selection data))) | 1197 | (setq data-type (get-text-property 0 'foreign-selection data))) |
| 1200 | (cond ((eq data-type 'public.utf16-plain-text) | 1198 | (cond ((eq data-type 'public.utf16-plain-text) |
| 1201 | (let ((encoded (and (fboundp 'mac-code-convert-string) | 1199 | (if (fboundp 'mac-code-convert-string) |
| 1202 | (mac-code-convert-string data | 1200 | (let ((s (mac-code-convert-string data nil coding))) |
| 1203 | 'utf-16 coding)))) | 1201 | (if s |
| 1204 | (if encoded | 1202 | (setq data (decode-coding-string s coding)) |
| 1205 | (let ((coding-save last-coding-system-used)) | 1203 | (setq data |
| 1206 | (setq data (decode-coding-string encoded coding)) | 1204 | ;; (decode-coding-string data 'utf-16) is |
| 1207 | (setq last-coding-system-used coding-save)) | 1205 | ;; not correct because |
| 1208 | (setq data | 1206 | ;; public.utf16-plain-text is defined as |
| 1209 | (decode-coding-string data 'utf-16))))) | 1207 | ;; native byte order, no BOM. |
| 1208 | (decode-coding-string | ||
| 1209 | (mac-code-convert-string data nil 'utf-8) | ||
| 1210 | 'utf-8)))) | ||
| 1211 | ;; No `mac-code-convert-string' means non-Carbon, which | ||
| 1212 | ;; implies big endian. | ||
| 1213 | (setq data (decode-coding-string data 'utf-16be)))) | ||
| 1210 | ((eq data-type 'com.apple.traditional-mac-plain-text) | 1214 | ((eq data-type 'com.apple.traditional-mac-plain-text) |
| 1211 | (setq data (decode-coding-string data coding))) | 1215 | (setq data (decode-coding-string data coding))) |
| 1212 | ((eq data-type 'public.file-url) | 1216 | ((eq data-type 'public.file-url) |
| @@ -1323,14 +1327,25 @@ in `selection-converter-alist', which see." | |||
| 1323 | (remove-text-properties 0 (length str) '(composition nil) str) | 1327 | (remove-text-properties 0 (length str) '(composition nil) str) |
| 1324 | (cond | 1328 | (cond |
| 1325 | ((eq type 'public.utf16-plain-text) | 1329 | ((eq type 'public.utf16-plain-text) |
| 1326 | (let (s) | 1330 | (if (fboundp 'mac-code-convert-string) |
| 1327 | (when (and (fboundp 'mac-code-convert-string) | 1331 | (let (s) |
| 1328 | (memq coding (find-coding-systems-string str))) | 1332 | (when (memq coding (find-coding-systems-string str)) |
| 1329 | (setq coding (coding-system-change-eol-conversion coding 'mac)) | 1333 | (setq coding |
| 1330 | (setq s (mac-code-convert-string | 1334 | (coding-system-change-eol-conversion coding 'mac)) |
| 1331 | (encode-coding-string str coding) | 1335 | (setq s (mac-code-convert-string |
| 1332 | coding 'utf-16))) | 1336 | (encode-coding-string str coding) |
| 1333 | (setq str (or s (encode-coding-string str 'utf-16-mac))))) | 1337 | coding nil))) |
| 1338 | (setq str (or s | ||
| 1339 | ;; (encode-coding-string str | ||
| 1340 | ;; 'utf-16-mac) is not correct because | ||
| 1341 | ;; public.utf16-plain-text is defined | ||
| 1342 | ;; as native byte order, no BOM. | ||
| 1343 | (mac-code-convert-string | ||
| 1344 | (encode-coding-string str 'utf-8-mac) | ||
| 1345 | 'utf-8 nil)))) | ||
| 1346 | ;; No `mac-code-convert-string' means non-Carbon, which | ||
| 1347 | ;; implies big endian. | ||
| 1348 | (setq str (encode-coding-string str 'utf-16be-mac)))) | ||
| 1334 | ((eq type 'com.apple.traditional-mac-plain-text) | 1349 | ((eq type 'com.apple.traditional-mac-plain-text) |
| 1335 | (let ((encodables (find-coding-systems-string str)) | 1350 | (let ((encodables (find-coding-systems-string str)) |
| 1336 | (rest mac-script-code-coding-systems)) | 1351 | (rest mac-script-code-coding-systems)) |