[Macemacsjp-users 861] Re: mac-key-mode.el with multibyte file/directory name

Back to archive index

Nozomu Ando nand****@mac*****
2005年 12月 29日 (木) 17:44:06 JST


Nozomu Ando <nand****@mac*****> writes:

> buffer-file-name には ~/ が含まれている可能性があるので、
> expand-file-name するようにする

失礼、~/ を含むのは buffer-file-name ではなくて、dired-directory でした。
(で、quoted form を使うから、expand-file-name しないといけないんんでした)

さきほどのパッチは捨てて下さい。申し訳ないです。

Nozomu Ando


*** mac-key-mode.el	17 Dec 2005 23:50:13 +0900	1.9
--- mac-key-mode.el	29 Dec 2005 17:33:16 +0900	
***************
*** 206,211 ****
--- 206,217 ----
  
  ;; Show In Finder
  
+ (defun mac-key-applescript-utf8data (str)
+   (concat "\307data utf8"
+ 	  (mapconcat (lambda (ch) (format "%02X" ch))
+ 		     (encode-coding-string str 'utf-8) "")
+ 	  "\310"))
+ 
  (defun mac-key-show-in-finder ()
    "Document forthcoming..."
    (interactive)
***************
*** 243,255 ****
        (condition-case err
            (progn
              (do-applescript
!              (format "tell application \"Finder\" to select (\"%s\" as POSIX file)"
!                      (if (eq selection-coding-system 'sjis-mac)
!                          (replace-regexp-in-string
!                           "\\\\" "\\\\\\\\"
!                           (encode-coding-string file selection-coding-system))
!                        (encode-coding-string file selection-coding-system))
!                      ))
              (if mac-key-smartactivate-command
                  (shell-command
                   (concat mac-key-smartactivate-command
--- 249,258 ----
        (condition-case err
            (progn
              (do-applescript
!              (concat
! 	      "tell application \"Finder\" to select (("
! 	      (mac-key-applescript-utf8data file)
! 	      " as Unicode text) as POSIX file)"))
              (if mac-key-smartactivate-command
                  (shell-command
                   (concat mac-key-smartactivate-command
***************
*** 277,283 ****
         ((string-match mac-key-remote-file-regexp dired-directory)
          (error "Remote directories not supported"))
         (t
!         (setq dir dired-directory))
         ))
       ((and (boundp 'buffer-file-name)
             (stringp buffer-file-name))
--- 280,286 ----
         ((string-match mac-key-remote-file-regexp dired-directory)
          (error "Remote directories not supported"))
         (t
!         (setq dir (expand-file-name dired-directory)))
         ))
       ((and (boundp 'buffer-file-name)
             (stringp buffer-file-name))
***************
*** 293,300 ****
          (condition-case err
              (progn
                (do-applescript
!                (format "tell application \"Terminal\" to do script with command \"cd %s\"" dir))
!               (if mac-key-smartactivate-command
                    (shell-command
                     (concat mac-key-smartactivate-command
                             " -i com.apple.Terminal"))
--- 296,306 ----
          (condition-case err
              (progn
                (do-applescript
!                (concat "tell application \"Terminal\" to do script"
! 		       " with command \"cd \" & quoted form of ("
! 		       (mac-key-applescript-utf8data dir)
! 		       " as Unicode text)"))
! 	      (if mac-key-smartactivate-command
                    (shell-command
                     (concat mac-key-smartactivate-command
                             " -i com.apple.Terminal"))



Macemacsjp-users メーリングリストの案内
Back to archive index