emacs23(Windows) 関連付けられたソフトで開く
問題
diredから、関連付けされたソフトでファイルを開きたい
解決方法
.emacsに以下を追加。
zを押すと関連づけファイルで開く。
;;; 関連付けられたソフトで開く (defun my-unix-to-dos-filename (s) (encode-coding-string (concat (mapcar '(lambda (x) (if(= x ?/) ?\\ x)) (string-to-list s))) 'sjis)) (defun my-x-open () "open file." (interactive) (let ((file (dired-get-filename))) (message "Opening %s..." file) (cond ((not window-system) (find-file file)) ((eq system-type 'windows-nt) (call-process "cmd.exe" nil 0 nil "/c" "start" "" (my-unix-to-dos-filename file))) ((eq system-type 'darwin) (call-process "open" nil 0 nil file)) (t (call-process "xdg-open" nil 0 nil file))) (recentf-add-file file) (message "Opening %s...done" file)) ) (add-hook 'dired-mode-hook (lambda () (define-key dired-mode-map "z" 'my-x-open)))
動作状況
- ファイル名漢字を含んだエクセルのファイルが開く。(WindowsXP)
参考
上のベースになったサイトは、分からなくなってしまった。(すみません)
http://www42.atwiki.jp/elisp/pages/12.html#id_1dc80d52
http://blog.os14.com/archives/812352.html