3 月 26
Meadow で、 dired から外部のプログラムへファイルを送る実験。
CraftDrop というコマンドラインからファイルを、起動中のプログラムへファイルをドラッグ&ドロップするプログラムを使用する。
cdrop.exe, cdropopt.exe, cdrop.dat(←cdrop.exeを初回起動時に作成される) を PATH の通ったところにコピー。
(めんどかったので、meadow/bin に放り込んだ)
.emacs に↓を追加:
;; dired で "c" でファイルを CraftDrop 送り
(add-hook 'dired-mode-hook
(lambda ()
(local-set-key "c" 'dired-exec-craftdrop)))
(defun dired-exec-craftdrop ()
"In dired, execute CraftDrop"
(interactive)
(craftdrop (dired-get-filename)))
;; 現在の行のファイルを craftdrop 送りにする
(define-process-argument-editing "/cdrop\\.exe$"
(lambda (x)
(general-process-argument-editing-function x nil nil nil)))
(defun craftdrop (&optional fname)
(interactive)
(if (not (file-exists-p fname))
(message "%s can't open." fname)
(setq fname (unix-to-dos-filename fname))
(let ((w32-start-process-show-window t))
(apply (function start-process)
"cdrop" nil "cdrop.exe" (list fname)))))
C-x d で dired を起動して、何かファイルにカーソルを合わせた状態で c を押すと、そのファイルを CraftDrop 送りにできる。
CraftDrop をまだ、ちゃんと使ってないので、このコードが活きてくるのか不明・・・。
参考にしたサイト: