PPxで新しいファイルを作成

PPxのカレントフォルダに新しいファイルを作る方法です。Xyzzyを利用します。

Xyzzyのsite-lispに次のファイルを保存。

make-file.l

(defun make-file ()
  (interactive)
  (if si:*command-line-args* (find-file (pop si:*command-line-args*))))

.xyzzyには次を追加。

(require "make-file")

カレントバッファを引数のファイルにするだけのスクリプトです。

ついで、PPxで次のようなメニューを作る。

M_makefile

M_makefile	= {	** comment **
TextFile(&txt)	= %Ob D:\bin\xyzzy\xyzzy.exe -e (make-file) %1\%"テキストファイル"%{%|.txt%}
PlainFile	= %Ob D:\bin\xyzzy\xyzzy.exe -e (make-file) %1\%"PlainFile"%E
&VBScript	= %Ob D:\bin\xyzzy\xyzzy.exe -e (make-file) %1\%"VBScript"%{%|.vbs%}
&JScript	= %Ob D:\bin\xyzzy\xyzzy.exe -e (make-file) %1\%"JScript"%{%|.js%}
--	= 
ディレクトリ(&D)	= *makedir %1\%E
}

これを適当なキーに登録。僕はShift+Kに登録しています。


後は、ファイル作成した後自動的に作成したファイルにカーソルがいくようになるといいんだけどな。

追記(2011/12/06)

PPx作者のTOROさんに、これのやり方を教えて頂きました。感謝!

M_makefile	= {	** comment **
TextFile(&txt)	= *set name=%1\%"テキストファイル"%{%|.txt%} %: *makefile "%'name'" %: editor "%'name'" %: *jumppath "%'name'" /entry
PlainFile	= *set name=%1\%"PlainFile"%E %: *makefile "%'name'" %: editor "%'name'" %: *jumppath "%'name'" /entry
&VBScript	= *set name=%1\%"VBScript"%{%|.vbs%} %: *makefile "%'name'" %: editor "%'name'" %: *jumppath "%'name'" /entry
&JScript	= *set name=%1\%"JScript"%{%|.js%} %: *makefile "%'name'" %: editor "%'name'" %: *jumppath "%'name'" /entry
--	= 
ディレクトリ(&D)	= *makedir %1\%E
}