list-load-path-shadowsのanything-source
(defvar anything-c-list-load-path-shadows-cache-buffer nil) (defvar anything-c-source-list-load-path-shadows `((name . "List load pash shadows") (init . (lambda () (unless (anything-candidate-buffer) (save-selected-window (call-interactively 'list-load-path-shadows)) (with-current-buffer (anything-candidate-buffer 'global) (setq anything-c-list-load-path-shadows-cache-buffer (current-buffer)) (dolist (arg (with-current-buffer "*Shadows*" (goto-char (point-min)) (loop while (re-search-forward "hides" nil t) collect (list (point-at-bol) (1+ (point-at-eol)))))) (apply 'insert-buffer-substring "*Shadows*" arg)))))) (candidates-in-buffer) (candidate-number-limit . 9999))) (defun anything-c-list-load-path-shadows-clear-cache () (interactive) (kill-buffer anything-c-list-load-path-shadows-cache-buffer))
二回目以降はキャッシュしたデータを使います。
キャッシュクリアは M-x anything-c-list-load-path-shadows-clear-cache
2008/09/09
save-excursionで囲むようにしました。
2008/09/09
id:rubikitchさんからコメント欄で教えていただいたソースに変更。
いままでanything-candidate-buffer関数の引数を勘違いしていました。
引数 'local(non-nil value) でつくるとバッファローカルなcandidate-bufferになってしまうのですね。
(dolist (arg (with-current-buffer '*Shadows*' (goto-char (point-min)) (loop while (re-search-forward "hides" nil t) collect (list (point-at-bol) (1+ (point-at-eol)))))) (apply 'insert-buffer-substring "*Shadows*" arg))
insert-buffer-substringは初めて知りました、美しいかも。