More Related Content
Similar to はじめてのanything-c-source-*
Similar to はじめてのanything-c-source-*(20)
はじめてのanything-c-source-*
- 2. (self-intoroduce 'k1LoW)
• type:
– Programmer
• Emacs Lisp
– http://emacswiki.org/k1LoW
• Membership:
– fukuoka-emacs
– Fusic Co.,Ltd >> http://fusic.co.jp
– codecheck.in >> http://trac.codecheck.in
and 101000code / 3rdSTONE
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 2
- 4. ここ数年で発生し蔓延している
感染症があります
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 4
- 5. この中の人にも何人かいるかと
思います
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 5
- 10. 症状
• Em acs Lispの候補選択フレームワークであ
るanything.elの操作性に慣れきってしまい、
なんでもかんでも「完全一致」、「部分一致
+AN D検索」、「正規表現」、「m igem o」
で絞り込み検索ができないのか考えてしまう
中毒症状。
• Em acs環境以外でのプログラム生活で支障を
きたし、「Em acsキーバインド以来の中毒性
が見られる」と提言する専門家も。
• anything.elのメンテナであるid:rubikitchも
anything脳であることが本人の告白により明
らかになっている。
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 10
- 11. みなさん注意喚起を
お願いします!!
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 11
- 13. はじめての
anything-c-source-*
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 13
- 14. anything-c-source-*
• anything.elの選択候補となるコード
• anything.elはanything-c-source-*を選
択候補させるフレームワーク
– anything.elはanything-c-
source-*がないとはじまらない
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 14
- 16. anything-config.el
• `anything-c-source-complex-command-history' (Complex Command History)
• `anything-c-source-extended-command-history' (Emacs Commands History)
• `anything-c-source-emacs-commands' (Emacs Commands)
• `anything-c-source-lacarte' (Lacarte)
• `anything-c-source-emacs-functions' (Emacs Functions)
• `anything-c-source-emacs-functions-with-abbrevs' (Emacs Functions)
• `anything-c-source-emacs-variables' (Emacs Variables)
• `anything-c-source-bookmarks' (Bookmarks)
• `anything-c-source-bookmark-set' (Set Bookmark)
• `anything-c-source-bookmarks-ssh' (Bookmarks-ssh)
• `anything-c-source-bookmarks-su' (Bookmarks-root)
• `anything-c-source-bookmarks-local' (Bookmarks-Local)
• `anything-c-source-w3m-bookmarks' (W3m Bookmarks)
• `anything-c-source-elisp-library-scan' (Elisp libraries (Scan))
• `anything-c-source-imenu' (Imenu)
-uuu:---F1 tokyo-emacs #x2009.9.6 02 All(1.0) (Emacs-Lisp ppt)---- 16
- 17. anything-config.el
• `anything-c-source-ctags' (Exuberant ctags)
• `anything-c-source-semantic' (Semantic Tags)
• `anything-c-source-simple-call-tree-functions-callers' (Function is called by)
• `anything-c-source-simple-call-tree-callers-functions' (Function calls)
• `anything-c-source-commands-and-options-in-file' (Commands/Options in file)
• `anything-c-source-customize-face' (Customize Face)
• `anything-c-source-colors' (Colors)
• `anything-c-source-tracker-search' (Tracker Search)
• `anything-c-source-mac-spotlight' (mdfind)
• `anything-c-source-icicle-region' (Icicle Regions)
• `anything-c-source-kill-ring' (Kill Ring)
• `anything-c-source-mark-ring' (mark-ring)
• `anything-c-source-global-mark-ring' (global-mark-ring)
• `anything-c-source-register' (Registers)
• `anything-c-source-fixme' (TODO/FIXME/DRY comments)
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 17
- 18. anything-config.el
• `anything-c-source-rd-headline' (RD HeadLine)
• `anything-c-source-oddmuse-headline' (Oddmuse HeadLine)
• `anything-c-source-emacs-source-defun' (Emacs Source DEFUN)
• `anything-c-source-emacs-lisp-expectations' (Emacs Lisp Expectations)
• `anything-c-source-emacs-lisp-toplevels' (Emacs Lisp Toplevel / Level 4
Comment / Linkd Star)
• `anything-c-source-org-headline' (Org HeadLine)
• `anything-c-source-yaoddmuse-emacswiki-edit-or-view' (Yaoddmuse Edit or View
(EmacsWiki))
• `anything-c-source-yaoddmuse-emacswiki-post-library' (Yaoddmuse Post library
(EmacsWiki))
• `anything-c-source-eev-anchor' (Anchors)
• `anything-c-source-picklist' (Picklist)
• `anything-c-source-bbdb' (BBDB)
• `anything-c-source-evaluation-result' (Evaluation Result)
• `anything-c-source-calculation-result' (Calculation Result)
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 18
- 19. anything-config.el
• `anything-c-source-google-suggest' (Google Suggest)
• `anything-c-source-surfraw' (Surfraw)
• `anything-c-source-emms-streams' (Emms Streams)
• `anything-c-source-emms-dired' (Music Directory)
• `anything-c-source-jabber-contacts' (Jabber Contacts)
• `anything-c-source-call-source' (Call anything source)
• `anything-c-source-occur' (Occur)
• `anything-c-source-create' (Create)
• `anything-c-source-minibuffer-history' (Minibuffer History)
• `anything-c-source-elscreen' (Elscreen)
• `anything-c-source-xrandr-change-resolution' (Change Resolution)
• `anything-c-source-xfonts' (X Fonts)
• `anything-c-source-gentoo' (Portage sources)
• `anything-c-source-use-flags' (Use Flags)
• `anything-c-source-emacs-process' (Emacs Process)
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 19
- 20. anything-function
• anything()を利用して独自の関数を作成
• anything-c-source-*をリストするだけでも
OK
(defun my-anything-find-file ()
"My `anything'."
(interactive)
(anything (list anything-c-source-buffers
anything-c-source-files-in-current-dir
anything-c-source-file-name-history)
initial-pattern
"Find File: " nil))
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 20
- 21. anything-function
• anything()を利用して独自の関数を作成
• anything-c-source-*をリストするだけでも
OK
(defun my-anything-find-file ()
"My `anything'."
(interactive)
(anything (list anything-c-source-buffers
anything-c-source-files-in-current-dir
anything-c-source-file-name-history)
initial-pattern
"Find File: " nil))
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 21
- 22. anything-function
• anything()を利用して独自の関数を作成
• anything-c-source-*をリストするだけでも
OK
(defun my-anything-find-file ()
"My `anything'."
(interactive)
(anything (list anything-c-source-buffers
anything-c-source-files-in-current-dir
anything-c-source-file-name-history)
initial-pattern
"Find File: " nil))
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 22
- 23. anything()の引数
• ANY-SOURCES
– anything-c-source-*リスト
• ANY-INPUT
– anything()に渡す初期入力
• ANY-PROMPT
– mini-bufferに出るプロンプト文字列
• ANY-RESUME
– anything()実行する際に初期かするか
• ANY-PRESELECT
– anything()実行時に選択する文字列
• ANY-BUFFER
– anything()実行時に使用するバッファ
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 23
- 24. anything()の引数
• ANY-SOURCES
– anything-c-source-*リスト
• ANY-INPUT
– anything()に渡す初期入力
• ANY-PROMPT
– mini-bufferに出るプロンプト文字列
• ANY-RESUME
– anything()実行する際に初期かするか
• ANY-PRESELECT
– anything()実行時に選択する文字列
• ANY-BUFFER
– anything()実行時に使用するバッファ
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 24
- 26. anything-c-source-*の設定
(自分が使ったことあるものだけ)
• Init
– 初期処理
• name
– anytnig-c-sourceの名前(呼び出されたときに名前がつ
く)
• candidates
– 候補リスト
• (candidate-in-buffer)
– candidatesをbufferで作ったとき設定する
• action
– 選択した候補から渡される値をもとに実行する関数
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 26
- 27. anything-c-source-*の設定
(自分が使ったことあるものだけ)
• display-to-real
– candidatesから選択した候補を調整してactionに渡す
replace関数
• type
– 候補リストのタイプ。設定するとデフォルトactionが
設定される
まだ多くあるけれども、使ったことないので省略
(いろいろ教えてください!)
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 27
- 28. /tmpディレクトリのファイルを
開くanything-c-source
• nameとcandidatesとtypeだけ
で作成できる
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 28
- 29. STEP1
• anything-c-sourceの変数を作
成
– 変数名はanything-c-source-
tmp-dir
(defvar anything-c-source-tmp-dir
'())
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 29
- 30. STEP2
• nameを決定
– “Tmp dir”
(defvar anything-c-source-tmp-dir
'((name . "Tmp dir")
)
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 30
- 31. STEP3
• typeを決定
– ファイルなのでfile
(defvar anything-c-source-tmp-dir
'((name . "Tmp dir")
(type . file)))
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 31
- 32. STEP4
• candidatesを作成
– /tmp内のファイルをリストで
返す関数をセット
(defvar anything-c-source-tmp-dir
'((name . "Tmp dir")
(candidates . (lambda () (directory-files "/tmp")))
(type . file)))
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 32
- 34. STEP5
• anything-c-source-tmp-dirを
my-anything-find-fileに追加
(defun my-anything-find-file ()
"My `anything'."
(interactive)
(anything (list anything-c-source-buffers
anything-c-source-files-in-current-dir
anything-c-source-file-name-history
anything-c-source-tmp-dir)
initial-pattern
"Find File: " nil))
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 34
- 36. まとめ
• anything-c-source-*を作成す
るのは簡単!
• より高度なことをしたいときは
、同じようなことをしている
anything-c-source-*をみてみ
ればOK
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 36
- 38. skype.elがEmacs22系でも
動くようになりました。
NTEmacsなどでも動きます。
id:kiwanami
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 38
- 39. 近々codecheck.inに
コミットします
id:kiwanami
-uuu:---F1 tokyo-emacs #x02 2009.9.6 All(1.0) (Emacs-Lisp ppt)---- 39
- 40. id:IMAKADO君、
デバッグよろしく
id:kiwanami
-uuu:---F1 tokyo-emacs #x2009.9.6 02 All(1.0) (Emacs-Lisp ppt)---- 40