ac-dabbrev.el を対応させたのですがね。

どうもりんこ。りんこで思い出したが,このりんこのマルシー的存在の
ゆうこりんが大変みたいですね。知らんし,どうでもいいけど。
低血流筋トレ-->疲れる-->とても眠い-->寝る-->頭痛くなる-->色々やるのがしんどくなる
の悪循環まっただなかの whitypig です。

auto-complete.el 達を最新のものにしたものだと思っていたのですがね。

ドキュメントを眺めていて,オレの環境だと,関数の場合は右側に`f'が表示されねーなー,
なぜだ?? と思ったのがことの発端。
しらべてみたら,1.0 だったorz。どこで何を間違ったんだ?
ローカルのリポジトリ調べたら,1.2だった。何故?
ちゅうわけで,1.2を入れた。なんかおかしな設定がしてあったのでその1行を削除した。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; auto-complete mode
;; http://www.emacswiki.org/emacs/AutoComplete
;; http://cx4a.org/repo/auto-complete.git
(when (and (require 'auto-complete nil t) (require 'auto-complete-config nil t))
  (require 'ac-dabbrev)
  (require 'auto-complete-etags)
  (global-auto-complete-mode t)
  (setq ac-auto-start 2)
  (set-default 'ac-sources '(ac-source-abbrev ac-source-words-in-buffer))
  (setq ac-modes (append ac-modes '(jde-mode)))
  (define-key ac-completing-map "\C-n" 'ac-next)
  (define-key ac-completing-map "\C-p" 'ac-previous)
  (define-key ac-mode-map "\C-c\C-i" 'auto-complete)
  (custom-set-faces  '(pulldown-default-face ((t (:background "slate gray" :foreground "white"))))
                     '(pulldown-default-selection-face ((t (:background "blue" :foreground "white"))))
                     '(ac-completion-face ((t (:background "blue" :foreground "white"))))
                     '(ac-candidate-face ((t (:background "slate gray" :foreground "white"))))
                     '(ac-selection-face ((t (:background "blue" :foreground "white"))))
                     '(ac-dabbrev-menu-face ((t (:background "slate gray" :foreground "white"))))
                     '(ac-dabbrev-selection-face ((t (:background "firebrick4" :foreground "white"))))
                     '(ac-gtags-candidate-face ((t (:background "slate gray" :foreground "white"))))
                     '(ac-gtags-selection-face ((t (:background "indian red" :foreground "white"))))
                     '(ac-etags-candidate-face ((t (:background "slate gray" :foreground "white"))))
                     '(ac-etags-selection-face ((t (:background "sienna" :foreground "white")))))
  )

問題が起きたのですがね。

ま,右端に`f'が出てないのですが,これは後回し。
Meadow を再起動してscratchでごにょっても補完されん。
調べてみると,ac-dabbrev.el が原因だった。

ソースに手を入れたのですがね。

まず,diff です。
もとのバージョンは,http://www.emacswiki.org/emacs/ac-dabbrev.el から入手できる,
0.0.8 です。

--- ac-dabbrev.el	2010/04/01 10:45:14	1.2
+++ ac-dabbrev.el	2010/04/01 11:19:06
@@ -77,10 +77,23 @@
           (sort all-expansions (lambda (s1 s2) (if (< (length s1) (length s2)) t nil)))
         all-expansions))))
 
+(defun ac-dabbrev-find-all-expansions (abbrev ignore-case)
+  (let ((all-expansions nil))
+    (save-excursion
+      (goto-char (point-min))
+      (setq all-expansions (dabbrev--find-all-expansions abbrev ignore-case))
+      (if ac-dabbrev-sort
+          (sort all-expansions (lambda (s1 s2) (if (< (length s1) (length s2)) t nil)))
+        all-expansions))))
+
 (defun ac-dabbrev-get-limit-candidates (abbrev &optional all)
-  (let ((dabbrev-check-other-buffers all))
+  (let ((dabbrev-check-other-buffers all)
+        ;; TODO what to do when `smart' is set in ac-ignore-case?
+        (icase (if (equal ac-ignore-case t) t nil)))
     (dabbrev--reset-global-variables)
-    (ac-dabbrev-find-limit-expansions abbrev ac-candidate-max nil)))
+    (if (and ac-candidate-limit (numberp ac-candidate-limit))
+        (ac-dabbrev-find-limit-expansions abbrev ac-candidate-limit icase)
+      (ac-dabbrev-find-all-expansions abbrev icase))))
 
 (lexical-let ((count 1))
   (defun ac-dabbrev-set-count ()
原因は,ac-candidate-max が nilだったのですがね。

で,ac-dabbrev-find-limit-candidates 関数内で,
(while (< i limit) ...) していたので,wrong-type-argumentだっけ? そんなんで,
怒られてた。ですが,最初はエラーもでなかったので気付かなかったのです。
独自に defvar しようかとも思ったのですが,迷ったあげく,ac-candidate-limit を
見てみることにした。別個に設定するのは面倒かなぁと思ったから。
なので,そいつが,nil の時には,ac-dabbrev-find-all-expansions で,
ぜーんぶ探しちゃうようにしました。
てーか,limit-candidates の中で,all-expansions というのもおかしな気がしますが。
あと,ac-ignore-case にsmartが設定されていたら,ワタシは心身ともにsmartではないので,
無視しちゃいます−。

課題ですがね。

一応動作してるようですが,なんかもっさりする。
候補をどばっと出す設定にしたりとか,auto-complete 本体の方の設定をまだしてないので,
それらをしたらどうなるかわからん。
あと,補完候補が出ている状態で,C-g とかで補完を中止して,
M-x auto-complete で補完を再開すると,
候補が,ac-source-dabbrev しかないときは,なんかバグる。
なぜかはわからん。
これはあとで調べる必要がありそう。

まとめ

右端に`f'をだすのがオレの夢だったのに。
儚い。儚すぎる。
てか,ac-source-words-in-same-mode-buffers があるので,そっちつかえばいいんでないの?
ても気がしますし,dabbrev の優位な点が浮かばない件。
あー,モードを複数指定できる点かな。

以上,おつかれっした。

追記

大事なこと忘れてた。
作者様達に感謝。
とくにドキュメントがすばらしいと思います。
あれだけのドキュメントを書くのはさぞ大変だったと思われます。
すばらしいソフトウェアをありがとう!
てか,感謝の意を忘れてどないすんねん,オレ。