https://sites.google.com/site/ppxmemo/
すっごい適当に名前を付けたので、そのうち変えるかもしれない。
あと、Memo on the Electronのサイトも一年ぶりくらいに大幅に手直ししたので良ければ見てください。
; -*- Mode: Lisp -*-
;
; メモファイルを引数のディレクトリに作成する
;
; キーバインド
; C-x,C-x 新たな見出し
;
; Installation:
;
; ~/.xyzzy または $XYZZY/site-lisp/siteinit.l に以下のコードを追加
;
; (require "onedaymemo")
(defun make-onedaymemo-file (memo-dir)
(let* ((filename (format-date-string "%Y-%m-%d.txt"))
(filepath (merge-pathnames filename memo-dir))
(directory (directory-namestring filepath)))
(if (not (file-directory-p directory))
(create-directory directory))
(find-file filepath)
(if (eq (point-max) (point-min))
(insert (format-date-string "%d %b %Y %H:%M:%S\n\n * : "))
(progn
(goto-char (point-max))
(insert (format-date-string "\n\n * : "))))))
(defun onedaymemo ()
(interactive)
(if si:*command-line-args* (setq x (pop si:*command-line-args*))(setq x nil))
(make-onedaymemo-file x)
(onedaymemo-mode))
(defun onedaymemo-mode ()
(interactive)
(kill-all-local-variables)
(setq buffer-mode 'onedaymemo-mode)
(setq mode-name "One Day Memo")
(use-keymap *onedaymemo-mode-map*))
(defvar *onedaymemo-mode-map* nil)
(unless *onedaymemo-mode-map*
(setq *onedaymemo-mode-map* (make-sparse-keymap))
(define-key *onedaymemo-mode-map* '(#\C-x #\C-x)
#'(lambda ()
(interactive)
(goto-char (point-max))
(insert (format-date-string "\n\n * : ")))))
(require "onedaymemo")
25 Jul 2015 17:03:46 * : Changelogのテスト 書式をChangeLogっぽく変えてみる * : 日付 日付とかはどうせファイルで分かるから不要?最初に起動するときだけにするとか。 あとは時間。これは本当に必要か?時間的なことが書きたいのなら、文中でやればいいだけかも。タイトルの区切りだけ入れるとか。 また、起動時に新規に作成するようにするか。 日付が必要な場合と不要な場合。あまり使わないだろうか。 あとはキーバインドをどうするか。C_x2度押しとか単純なのでいいかも。 * : PPvの一時コマンド なぜか中に入っていない。
KC_main = { ; PPcメイン窓
^Z ,*setnextkey K_launcher
}
K_launcher = { ** comment **
C ,%Ob D:\bin\xyzzy\xyzzy.exe -e (onedaymemo) D:\Work\Log
}
KC_main = { ; PPcメイン窓
F12 ,%M_cust,C
}
KV_main = { ; PPvメイン窓
F12 ,%M_cust,C
}
-|M_cust =
M_cust = { ** comment **
カスタマイザ(&C) = %K"@CUSTOMIZE"
編集して取込(&E) = %Ob *PPCUST /edit
-- =
取り込み(&1) = %Q"%FCを取り込みます"%:%Ob *PPCUST CS "%FCD"
追加(&2) = %Q"追加取込します"%:*customize @%FCD
-- =
PPX.CFGを取り込み(&3) = %Q"PPX.CFGを取り込みます"%:%Ob *PPCUST CS "%0\PPX.CFG"
PPX.CFGに書き出し(&4) = %Q"PPX.CFGに書き出します"%:%Ob *PPCUST CD "%0\PPX.CFG"
指定書き出し(&5) = %"指定ファイルに書き出します"%Ob *PPCUST CD %{%1\PPX-%*nowdatetime(y-N-D)%|.CFG%}
-- =
初期化(&I) = %Q"初期化します"%:%Ob *PPCUST CINIT
-- =
アップデート(&U) = %Ob *checkupdate p
バージョン情報(&V) = %K"@ABOUT"
}
//!*script
// フォルダ内のファイルパスを順番に返す
// 第一引数:フォルダパス
// 第二引数:識別子
// 引数がなければ終了
if (PPx.Arguments.Length < 2){
PPx.SetPopLineMessage("引数が正しくありません。");
PPx.Quit(-1);
}
fs = PPx.CreateObject("Scripting.FileSystemObject");
var objFileSys = new ActiveXObject("Scripting.FileSystemObject");
var fn = PPx.Arguments.Item(0);
var id = PPx.Arguments.Item(1);
var CurrentFile;
// フォルダが存在しなければ終了
if (objFileSys.FolderExists(fn) == false) {
PPx.SetPopLineMessage(fn+"は存在しません");
PPx.Quit(-1);
}
// 同階層のフォルダのリストを取得
objFolder = objFileSys.GetFolder(fn);
e = new Enumerator(objFolder.Files);
flds = new Array();
for( ; !e.atEnd(); e.moveNext()) {
flds.push(e.item().Name);
}
// フォルダが空なら終了
if (!flds[0]) {
PPx.SetPopLineMessage("ファイルは存在しません");
PPx.Quit(-1);
}
// 識別子が空ならリストの一番目を代入
if (!PPx.Extract("%'"+id+"'")){
CurrentFile = flds[0];
} else {
CurrentFile = PPx.Extract("%'"+id+"'");
}
// ファイルの位置を取得
for(i = 0; i < flds.length; i++) {
if( flds[i] == CurrentFile ) break;
}
var nextFile = flds[Math.min(i+1, flds.length-1)]; // 次のファイルを取得
// カレントフォルダがリスト最後なら最初にループ
if (nextFile == CurrentFile) {
nextFile = flds[0];
}
PPx.Execute("*set "+id+" = "+ nextFile); // 識別子に次のファイルをセット
PPx.Result = fs.BuildPath(fn,nextFile); // 値を返す
-|K_bookmark =
-|K_bookmarklist =
KC_main = { ; PPcメイン窓
^S ,*setnextkey K_bookmark
^X ,*setnextkey K_bookmarklist
}
K_bookmark = { ** comment **
S , *script %0\Script\setalias.js,bookmark,%%1
R , *script %0\Script\resetalias.js,bookmark
^S , %j %*script("%0\Script\rotateExecute3.js","homu","bookmark")
',' , *script %0\Script\bookmarkmenu.js
}
K_bookmarklist = { ** comment **
^X , *set name=%*script("%0\Script\RotateSubFile.js","%0\bookmark","blistid") %: *linemessage %*name(X,%'name') %: *script %0\Script\file2alias.js,%'name',bookmark
X ,*linemessage defaultに戻しました %: *script %0\Script\file2alias.js,%0\bookmark\default.txt,bookmark
}
//!*script
// 第一引数:開きたいファイルのパス
// 引数がなければ終了
if (PPx.Arguments.Length < 1){
PPx.SetPopLineMessage("引数が正しくありません。");
PPx.Quit(-1);
}
var path = PPx.Arguments.Item(0);
var fs = PPx.CreateObject( "Scripting.FileSystemObject" );
var editor = "D:\\bin\\xyzzy\\xyzzy.exe" // エディタのパス
var fsize = 1000 // 基準とするファイルサイズ
if (fs.GetFile(path).Size > fsize){
PPx.Execute ("%Ob \"" + editor + "\" " + path); // エディタで開く
} else {
PPx.Execute ("*ppe " + path); // PPeで開く
}
fs = null;
KC_main = { ; PPcメイン窓
\E ,*script %0\Script\editbysize.js,%FCD
}
KV_main = { ; PPvメイン窓
\E ,*script %0\Script\editbysize.js,%FCD
^E ,*script %0\Script\editbysize.js,%FCD
}
//!*script
if (PPx.Extract("%*extract(C\"%%t\")").match(/^(txt|text|howm|jpg|jpeg|bmp|png|gif|cpp|h|c|l|el|html|htm|xyzzy|emacs|scm|ini|vbs|js|py|pyw|cfg|kif)$/i)){
} else if (PPx.GetFileInformation(PPx.Extract("%*extract(C\"%%FCDN\")")) == ":DIR"){ // ディレクトリなら何もしない
} else{
PPx.Execute('*cliptext '+PPx.Extract("%*extract(C\"%%R\")")); // クリップボードにファイル名をコピー
PPx.Execute('%K\"^@V\"'); // Ctrl+Vで貼付け
PPx.Quit(-1); // 以降のコマンド実行を中止
}
KV_main = { ; PPvメイン窓
LEFT ,*execute C,*cursor 6,-1,4,B0000,0,B0000 %: *script %0\Script\stop.js %: *execute C,*ppv -bootid:A -r %%*name(CD,"%%R","%%1")
RIGHT ,*execute C,*cursor 6, 1,4,B0000,0,B0000 %: *script %0\Script\stop.js %: *execute C,*ppv -bootid:A -r %%*name(CD,"%%R","%%1")
UP ,*execute C,*cursor 2,-1,4,B0000,5,B0000 %: *script %0\Script\stop.js %: *execute C,*ppv -bootid:A -r %%*name(CD,"%%R","%%1")
DOWN ,*execute C,*cursor 2, 1,4,B0000,5,B0000 %: *script %0\Script\stop.js %: *execute C,*ppv -bootid:A -r %%*name(CD,"%%R","%%1")
SPACE ,*execute C,*script %0\Script\togglemark.js %: *execute C,*cursor 2, 1,4,B0000,5,B0000 %: *script %0\Script\stop.js %: *execute C,*ppv -bootid:A -r %%*name(CD,"%%R","%%1")
\SPACE ,*execute C,*script %0\Script\togglemark.js %: *execute C,*cursor 2,-1,4,B0000,5,B0000 %: *script %0\Script\stop.js %: *execute C,*ppv -bootid:A -r %%*name(CD,"%%R","%%1")
}
-|K_xyzzy =
K_ppe = { ; PPe(K_ppeに該当しない場合はK_editも参照)
^X ,*setnextkey K_xyzzy
}
K_xyzzy = { ** comment **
S ,%k"^S"
^C ,%k"&F4"
}