emacs-wikiは、Wikiライクな情報整理ツールです。(Wikiについて知りたい方 は参考文献の増井さんのPDF 7 を参照してください) 一般的なWikiは、コミュニケーショ ン用途に使われることがありますが、これは、個人的に情報を整理するツール として使われるもののようです。
もっとも、Emacs自体をWebサーバーにしてコラボレーション・ツールとして使 うことも出来るようですが、現実的な使用法ではないでしょう。
M-x emacs-wiki-find-file[Enter]としてファイルを開きます。普通に編集し て保存し、C-c C-pでpublish、つまりHTMLファイルを生成できます。 マークアップは様々なものが使えます3が、ページ上端に、
#title ページタイトル
とすることで、ページタイトルを修正できます。また、
[[KeyWord][リンクの説明]]
とすることで、リンク表記を変更できます。編集する際は C-c C-l でトグルさ せると便利。日本語のWikiキーワードを使うために様々な人が努力をしている が、このマシン上では上記の機能を応用し、英単語のWikiキーワードのみを使 うこととする。
縦棒を仕切り線にして以下のように入力すると、
時刻 || 場所 16:00 | フランクフルト着 19:00 | ハイデルベルグ着
このような表になる
| 時刻 | 場所 |
|---|---|
| 16:00 | フランクフルト着 |
| 19:00 | ハイデルベルグ着 |
テーブルの線とかは、emacs-wiki-table-attributes というのに保存する (customize-groupのEmacs Wiki Publishカテゴリにある) また、table.elというのに対応していてそれで表を作成すると適切な表になるらしい。
簡単なタグはそのまま追加できる場合もある。 イメージにリンクを張りたいときなどは、そのままだとうまくいかないので <verbatim>〜</verbatim>で囲ってやると良い。
例
(自分が使うときのための覚書ですので気にしないでください)
Meadowのバージョンを新しくして、(なぜかmeadow-versionができないが、 たぶん、2.10) 同時にemacs-wikiをバージョン 2.68 にしてみたら、 画像にリンクが張られるようになってしまった。
customize-groupでemacs-wikiを選び、publishカテゴリのなかの、 emacs-wiki-publishing-markupの末尾に追加で、
INS DEL Choice: Value Menu Markup rule:
Choice: Value Menu Regexp: <a [^>]+>\(<img [^>]+>\)</a>
Integer: 0
Choice: Value Menu String: \1
こんなふうにすると、リンクを取り除いてくれる。(Markup ruleの追加で、RegexpをStringにするようにchoiceしないとエラーになる)
参考にしたページ: http://yap.nucl.ap.titech.ac.jp/~shimada/ja/source/emacs-wiki.el (ありがとう!)
バージョン2.38がMeadowでエラーになるときは以下のように修正2
(:foreground "green" :underline "green" :bold t)) ↓ (:foreground "green" :underline t :bold t))
C-c C-b (emacs-wiki-backlink)が動作しない。実行するコマンドは以下のと おり:
cd c:/... .../My Documents/Webサイト/Wiki/ find "C:/... .../My Documents/Webサイト/Wiki" -type f ! -name '*~' | xargs egrep -n -e "\<EmacsWiki\>"
Meadow 1.14ではPerlタグによる埋め込みができない。これは、 make-temp-fileが定義されていないためで以下のように追加すれば使える。4 ただし、バッファのエンコーディングをUTF-8にした時に日本語入りのス クリプトを渡すと文字化けするようだ。(何故だろう?)
(or (fboundp 'make-temp-file)
(defun make-temp-file (prefix &optional dir-flag)
"Create a temporary file.
The returned file name (created by appending some random characters at
the end of PREFIX, and expanding against `temporary-file-directory' if
necessary, is guaranteed to point to a newly created empty file. You
can then use `write-region' to write new data into the file.
If DIR-FLAG is non-nil, create a new empty directory instead of a file."
(let (file)
(while (condition-case ()
(progn
(setq file
(make-temp-name
(expand-file-name prefix
temporary-file-directory)))
(if dir-flag
(make-directory file)
(write-region "" nil file nil 'silent nil 'excl))
nil)
(file-already-exists t))
;; the file was somehow created by someone else between
;; `make-temp-name' and `write-region', let's try again.
nil)
file)))
バッファの文字コード自動設定?6
(defun-add-hook 'emacs-wiki-mode-hook (setq buffer-file-coding-system 'iso-2022-jp-unix))
インラインイメージをバッファ上でも表示
(defun emacs-wiki-inline-image (beg end url &optional desc)
"Inline locally available images."
(let ((filename
(cond
((string-match "\\`\\(file\\|http\\):\\(.+\\)" url)
(match-string 2 url))
((string-match "/" url)
(expand-file-name url emacs-wiki-publishing-directory)))))
(unless (string-match "^/" filename)
(setq filename
(expand-file-name filename emacs-wiki-publishing-directory)))
(if (and filename (file-readable-p filename))
(add-text-properties beg end (list 'display (create-image filename)
'help-echo (or desc url))))))
[1] http://repose.cx/emacs/wiki/ ... Emacs Wikiの本拠地
[2] http://www.ops.dti.ne.jp/~cake-smd/wiki/EmacsWiki.html ... MeadowでUnderlineのエラーが出るとき
[3] http://emacswiki.org/johnw/WikiMarkup.html ... Wiki Markupの説明
[4] http://www.ruby-lang.org/~rubikitch/diary/0111/011122.html ... Meadowでのmake-temp-fileの実装について
[5] http://www.teria.com/~koseki/emacswiki/EmacsWiki.html ... Emacs Wikiの使い方
[6] http://air.zive.net/emacs-wiki/EmacsWiki.html ... XEmacs(?)でバッファ上でインラインでイメージ表示の拡張
[7] http://www.csl.sony.co.jp/person/masui/papers/SPA2003/SPA2003.pdf ... 増井 俊之. インターネット上の新しいコミュニケーションツール. 情報処理学会ヒューマンインタフェース研究会研究報告 (招待講演), Februrary, 2003.
[8] http://www.self-core.org/~kaoru-k/wiki/WikiMarkup.html ... Wiki Markupの説明