[macemacsjp-cvs 221] CVS update: CarbonEmacsPackage/GPL/mac

Back to archive index

Seiji Zenitani zenit****@users*****
2006年 1月 3日 (火) 23:24:42 JST


Index: CarbonEmacsPackage/GPL/mac/mac-key-mode.el
diff -u CarbonEmacsPackage/GPL/mac/mac-key-mode.el:1.11 CarbonEmacsPackage/GPL/mac/mac-key-mode.el:1.12
--- CarbonEmacsPackage/GPL/mac/mac-key-mode.el:1.11	Thu Dec 29 18:50:29 2005
+++ CarbonEmacsPackage/GPL/mac/mac-key-mode.el	Tue Jan  3 23:24:42 2006
@@ -1,9 +1,9 @@
 ;;; mac-key-mode.el --- provide mac-style key bindings on Carbon Emacs
 
-;; Copyright (C) 2004-2005  Seiji Zenitani <zenit****@mac*****>
+;; Copyright (C) 2004-2006  Seiji Zenitani <zenit****@mac*****>
 
 ;; Author: Seiji Zenitani <zenit****@mac*****>
-;; Version: v20051229
+;; Version: v20060103
 ;; Keywords: tools, mac
 ;; Created: 2004-12-27
 ;; Compatibility: Mac OS X (Carbon Emacs)
@@ -227,10 +227,22 @@
 
 ;; utf8 code by Ando-san
 (defun mac-key-applescript-utf8data (str)
-  (concat "\307data utf8"
-          (mapconcat (lambda (ch) (format "%02X" ch))
-                     (encode-coding-string str 'utf-8) "")
-          "\310"))
+  (let ((len (length str))
+        (len1 31) ;XXX: 254/2/4. utf-8 is 4byte per code point at most.
+        (reslist '(")"))
+        pos epos)
+    (setq pos len)
+    (while (> pos 0)
+      (setq epos pos)
+      (setq pos (max (- pos len1) 0))
+      (setq reslist (cons " & (\307data utf8"
+                          (cons (mapconcat (lambda (ch) (format "%02X" ch))
+                                           (encode-coding-string
+                                            (substring str pos epos)
+                                            'utf-8) "")
+                                (cons "\310 as Unicode text)"
+                                      reslist)))))
+    (apply 'concat "(\"\"" reslist)))
 
 ;; Show In Finder
 
@@ -272,9 +284,9 @@
           (progn
             (do-applescript
              (concat
-              "tell application \"Finder\" to select (("
+              "tell application \"Finder\" to select ("
               (mac-key-applescript-utf8data file)
-              " as Unicode text) as POSIX file)"))
+              " as POSIX file)"))
 ;;              (format "tell application \"Finder\" to select (\"%s\" as POSIX file)"
 ;;                      (if (eq selection-coding-system 'sjis-mac)
 ;;                          (replace-regexp-in-string
@@ -326,9 +338,8 @@
             (progn
               (do-applescript
                (concat "tell application \"Terminal\" to do script"
-                       " with command \"cd \" & quoted form of ("
-                       (mac-key-applescript-utf8data dir)
-                       " as Unicode text)"))
+                       " with command \"cd \" & quoted form of "
+                       (mac-key-applescript-utf8data dir)))
 ;;                (format "tell application \"Terminal\" to do script with command \"cd %s\"" dir))
               (if mac-key-smartactivate-command
                   (shell-command


macemacsjp-cvs メーリングリストの案内
Back to archive index