Mercurial > emacs
comparison lisp/term/mac-win.el @ 71356:a183bff9cb83
(mac-text-encoding-ascii): New constant.
(mac-utxt-to-string): Use it.
(mac-ts-update-active-input-area): Use mac-ae-number.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Fri, 16 Jun 2006 08:07:59 +0000 |
parents | ed68e074ebb4 |
children | fd5f866a10be a387c138b28e 138027c8c982 |
comparison
equal
deleted
inserted
replaced
71355:763764b2c2a4 | 71356:a183bff9cb83 |
---|---|
1247 (define-key special-event-map [language-change] 'mac-handle-language-change) | 1247 (define-key special-event-map [language-change] 'mac-handle-language-change) |
1248 | 1248 |
1249 | 1249 |
1250 ;;;; Conversion between common flavors and Lisp string. | 1250 ;;;; Conversion between common flavors and Lisp string. |
1251 | 1251 |
1252 (defconst mac-text-encoding-ascii #x600 | |
1253 "ASCII text encoding.") | |
1254 | |
1252 (defconst mac-text-encoding-mac-japanese-basic-variant #x20001 | 1255 (defconst mac-text-encoding-mac-japanese-basic-variant #x20001 |
1253 "MacJapanese text encoding without Apple double-byte extensions.") | 1256 "MacJapanese text encoding without Apple double-byte extensions.") |
1254 | 1257 |
1255 (defun mac-utxt-to-string (data &optional coding-system) | 1258 (defun mac-utxt-to-string (data &optional coding-system) |
1256 (or coding-system (setq coding-system mac-system-coding-system)) | 1259 (or coding-system (setq coding-system mac-system-coding-system)) |
1267 ;; Does it contain Apple one-byte extensions other than | 1270 ;; Does it contain Apple one-byte extensions other than |
1268 ;; reverse solidus? | 1271 ;; reverse solidus? |
1269 (if (string-match "[\xa0\xfd-\xff]" str) | 1272 (if (string-match "[\xa0\xfd-\xff]" str) |
1270 (setq str nil) | 1273 (setq str nil) |
1271 ;; ASCII-only? | 1274 ;; ASCII-only? |
1272 (unless (string-match "\\`[[:ascii:]]*\\'" str) | 1275 (unless (mac-code-convert-string data nil mac-text-encoding-ascii) |
1273 (subst-char-in-string ?\x5c ?\¥ str t) | 1276 (subst-char-in-string ?\x5c ?\¥ str t) |
1274 (subst-char-in-string ?\x80 ?\\ str t))))) | 1277 (subst-char-in-string ?\x80 ?\\ str t))))) |
1275 (or str | 1278 (or str |
1276 (decode-coding-string data | 1279 (decode-coding-string data |
1277 (if (eq (byteorder) ?B) 'utf-16be 'utf-16le))))) | 1280 (if (eq (byteorder) ?B) 'utf-16be 'utf-16le))))) |
1963 (text (or (cdr (mac-ae-parameter ae "tstx" "utxt")) "")) | 1966 (text (or (cdr (mac-ae-parameter ae "tstx" "utxt")) "")) |
1964 (script-language (mac-ae-script-language ae "tssl")) | 1967 (script-language (mac-ae-script-language ae "tssl")) |
1965 (coding (or (cdr (assq (car script-language) | 1968 (coding (or (cdr (assq (car script-language) |
1966 mac-script-code-coding-systems)) | 1969 mac-script-code-coding-systems)) |
1967 'mac-roman)) | 1970 'mac-roman)) |
1968 (fix-len (mac-bytes-to-integer | 1971 (fix-len (mac-ae-number ae "tsfx")) |
1969 (cdr (mac-ae-parameter ae "tsfx" "long")))) | |
1970 ;; Optional parameters | 1972 ;; Optional parameters |
1971 (hilite-rng (mac-ae-text-range-array ae "tshi")) | 1973 (hilite-rng (mac-ae-text-range-array ae "tshi")) |
1972 (update-rng (mac-ae-text-range-array ae "tsup")) | 1974 (update-rng (mac-ae-text-range-array ae "tsup")) |
1973 ;;(pin-rng (mac-bytes-to-text-range (cdr (mac-ae-parameter ae "tspn" "txrn")))) | 1975 ;;(pin-rng (mac-bytes-to-text-range (cdr (mac-ae-parameter ae "tspn" "txrn")))) |
1974 ;;(clause-offsets (cdr (mac-ae-parameter ae "tscl" "ofay"))) | 1976 ;;(clause-offsets (cdr (mac-ae-parameter ae "tscl" "ofay"))) |
2006 (mac-split-string-by-property-change mac-ts-active-input-buf) | 2008 (mac-split-string-by-property-change mac-ts-active-input-buf) |
2007 "")) | 2009 "")) |
2008 (put-text-property 0 (length active-input-string) | 2010 (put-text-property 0 (length active-input-string) |
2009 'mac-ts-active-input-string t active-input-string) | 2011 'mac-ts-active-input-string t active-input-string) |
2010 (if use-echo-area | 2012 (if use-echo-area |
2011 (let (msg message-log-max) | 2013 (let ((msg (current-message)) |
2012 (if (and (current-message) | 2014 message-log-max) |
2015 (if (and msg | |
2013 ;; Don't get confused by previously displayed | 2016 ;; Don't get confused by previously displayed |
2014 ;; `active-input-string'. | 2017 ;; `active-input-string'. |
2015 (null (get-text-property 0 'mac-ts-active-input-string | 2018 (null (get-text-property 0 'mac-ts-active-input-string |
2016 (current-message)))) | 2019 msg))) |
2017 (setq msg (propertize (current-message) 'display | 2020 (setq msg (propertize msg 'display |
2018 (concat (current-message) | 2021 (concat msg active-input-string))) |
2019 active-input-string))) | |
2020 (setq msg active-input-string)) | 2022 (setq msg active-input-string)) |
2021 (message "%s" msg) | 2023 (message "%s" msg) |
2022 (overlay-put mac-ts-active-input-overlay 'before-string nil)) | 2024 (overlay-put mac-ts-active-input-overlay 'before-string nil)) |
2023 (move-overlay mac-ts-active-input-overlay | 2025 (move-overlay mac-ts-active-input-overlay |
2024 (point) (point) (current-buffer)) | 2026 (point) (point) (current-buffer)) |