cppref.el のバグっぽいのを修正しました。
どうもです。
もう,google test が素敵すぎて,cppunit を使ったこと無いけど,
cppunitよりも使いやすいんじゃね? だって,クラス作らなくてテスト書けるし,
とか思っちゃってるわけで。
search を search したけど,search できない。
cppref.el で,search を検索したけど,bsearch, binary_search しか候補にでない
状態で,なんでだろうなぁと思ったのが,cppref.el使い始めの頃。
ほいで,今日調べてみたら,algorithm/search.htmlが存在しているので,
見つからないことないだろうと。
で,頑張ってみたら,バグっぽいのを発見したとです。
ワタシの環境でしか再現しないかもしれませんが。
そのバグというのは,候補が複数あるときに,
変数candidatesの最初の要素が削除されちゃうというものです。
以下,diff。
本体は,こちらから。
http://github.com/whitypig/emacs-cppref/blob/master/cppref.el
diff --git a/cppref.el b/cppref.el index 077a119..cc3d68c 100644 --- a/cppref.el +++ b/cppref.el @@ -91,14 +91,15 @@ browser." (list file) (cppref-find-reference cppref-doc-dir name)))) - (setq reference (car candidates)) - (setq candidates (cdr candidates)) - - (if (not reference) - (error (concat "no document found for " name))) - (if candidates - (setq reference (cppref-select-from-multiple-choices - candidates))) + (cond + ((not candidates) + (error (concat "no document found for " name))) + ((= 1 (length candidates)) + (setq reference (car candidates))) + ((> (length candidates) 1) + (setq reference (cppref-select-from-multiple-choices + candidates)))) + (cppref-visit-reference reference cppref-open-in-the-same-window))) (defun cppref-read-primary-args ()
まとめ
これで,以前悩まされた,M-x cppref ==> pair もダイジョウブイ!
いま気づいたけど,cppref-read-primary-args って,
引数1つしか読んでないんだから,args って複数はおかしいね。
あとで気が向いたら修正する。