mcomplete.el のバグを直せたかも
どーもです。
ちょっと前に,バグを修正して気をよくしたのもつかの間,
新たに別のエラーが発生するというなんとも悲しい状態に。
こんなん。
Wrong type argument: sequencep, t
で,今回は現実逃避のために,このエラーの原因を探ってみました。
原因はというと,#'mcomplete-substr-method-try-completion で,
#'try-completion の結果と文字列を #'concat でつなぐところ。
#'try-completion が `t' を返しちゃったら,こける。
行った修正はというと,t が帰ってきたら,"" と,そうでない場合は,
#'try-completion の結果と,文字列を結合するというやっつけ仕事。
以下修正後の関数。
(defun mcomplete-substr-method-try-completion (str abort-on-input) "`try-completion' for substring match method of `mcomplete-mode'." (let* ((completions (mcomplete-all-completions str abort-on-input))) (cond ((null completions) ; 0 candidate nil) ((null (cdr completions)) ; 1 candidate (if (string= str (car completions)) t (car completions))) (t ; multiple candidates (let* ((regexp (regexp-quote str)) (tails-alist (mapcar #'(lambda (item) (string-match regexp item) (list (substring item (match-end 0)))) completions)) (tail (try-completion "" tails-alist))) (concat str (if (eq t tail) "" tail)))))))
んで以下,diff。
github で管理したいんだけど,どうしたらいいんだろう。
オリジナルは github にないから,悩みどころ。
diff --git a/mcomplete.el b/mcomplete.el index d00e548..4e3cde9 100644 --- a/mcomplete.el +++ b/mcomplete.el @@ -1305,8 +1305,11 @@ Otherwise try to complete it." (tails-alist (mapcar #'(lambda (item) (string-match regexp item) (list (substring item (match-end 0)))) - completions))) - (concat str (try-completion "" tails-alist))))))) + completions)) + (tail (try-completion "" tails-alist))) + (concat str (if (eq t tail) + "" + tail))))))) (defface mcomplete-substr-method-fixed-part-face
今さっき修正したばっかりなので,これで解決したかどうかわからんが,
しばらくこれで使ってみます。
とりあえずだとしても,なおって良かった!
いぇい。