header

2013年1月17日木曜日

helmプログラミングのメモ

helmプログラミングのメモ

最近Helmのプログラミングをしていて、気になったことのメモ
option引数?キーワード引数?のようなものについての記事です。

helmの中をgrepしてみました。

helmパッケージの中を:sourceでgrepしてみました。
…使い方をよくわかってないですがリストアップしてみます。
scratchバッファに貼り付けて確認できるので
helmのコード書くときの参考程度に使っていただければと思います。
ちなみに、よくわかっていない設定についてや
便利な設定についてコメントいただければ非常によろこびます:)

(helm :sources
'(((name . "helm-test-code")
;; 候補
(candidates . (lambda ()
'("hoge hoge" nil "fuga hoge" "" "piyo")))
;; 複数行に対応
(multiline)
;; マッチワードをハイライトしない
(nohighlight)
(action . (lambda (arg)
(message arg)))
;; 何の遅延かよくわからない
(delayed)))
;; ここで指定した文字数以上入力しないと検索しない
:requires-pattern (if (string= helm-pattern "")
0
3)
;; 候補の限界
:candidate-numer-limit 50
;; 入力してからの遅延
:input-idle-delay 0.3
;; ミニバッファに表示される説明用の文字列
:prompt "displayed string to mini-buffer's prompt: "
;; バッファ名
:buffer "*helm buffer name*"
;; tにすると画面全体にhelmの候補を表示
:full-frame t
;; 実行前の検索ワードに入れる文字
;; 下のは実際のコードで利用されていた方法
;; minibufferには表示されない
;; :preselect (thing-at-point 'symbol)
;; preselectと同じような使い方が
;; できると思いますがminibufferの中に表示される
;; のが大きな違いでしょうか
;; :input (when t "input string")
;; minubuffer のヒストリーのデフォルトに入ります。
;; (M-p, M-nで確認できます)
:default "minubufferのヒストリーのデフォルトに入る"
;; 確認してないけど多分helmのキーマップ
;; :keymap helm-map

;; helm-candidates-in-bufferの説明:
;; Get candidates from the candidates buffer according to `helm-pattern'.
;; By default, `helm' makes candidates by evaluating the
;; candidates function, then narrows them by `string-match' for each
;; candidate.
;; But this way is very slow for many candidates.
;; The new way is storing all candidates in a buffer and narrowing them by
;; `re-search-forward'.
;; Search function is customizable by search
;; attribute. The important point is that buffer processing is MUCH
;; FASTER than string list processing and is the Emacs way.
;; 適当な訳: `helm-pattern'に従いcandidates bufferから候補を取得する
;; デフォルトでhelmはcandidates関数を実行することによって候補を作る。
;; その時これらの個々の候補を`string-match'によって絞るがこれはとても遅い。
;; 新しい方法は全ての候補を`re-search-forward'によってbufferの中で
;; 記憶し候補を絞る。
;; 検索関数はsearch属性によってカスタマイズされる
;; 重要な点はそのbufferの中の処理は文字列のリスト処理よりかなり速いことだ
;; 訳終わり、、、とりあえずtにしとけばOKと思います。
:candidates-in-buffer t
)

0 件のコメント:

コメントを投稿

Popular Posts

Blogger templates

Blogger news