単語を調べるための helm-sourceです。選択した単語を alc.co.jpのページを開きます。
単語候補は "look ."で生成しています。
コード
(defun helm-alc:init () (with-current-buffer (helm-candidate-buffer 'global) (let ((ret (call-process-shell-command "look ." nil t))) (unless (zerop ret) (error "Failed look "))))) (defun helm-alc:action (word) (loop for marked in (helm-marked-candidates) for url = (format "http://eow.alc.co.jp/%s/UTF-8/?ref=sa" marked) do (browse-url url))) (defvar helm-c-source-alc '((name . "alc") (init . helm-alc:init) (candidates-in-buffer) (candidate-number-limit . 100) (action . helm-alc:action) (requires-pattern . 2))) (defun helm-alc () (interactive) (helm :sources '(helm-c-source-alc) :buffer "*helm alc*"))
おわりに
lookコマンドは意外と使えますね。