LoginSignup
4
4

More than 5 years have passed since last update.

helm-buffers-listとhelm-migemo

Posted at

Emacs - helm-migemoでさらにはまった - Qiita
で偽りの解決をしました。

まずその解決では他のhelmコマンド helm-find-files などでの
挙動がおかしくなってしまいます。補完が効かなくなってしまいます。

これはまずい。ということで helm-buffers-list の時だけ
helm-migemoが使えるようにしてみました。

(defun helm-compile-source--migemo (source)
  (if (not (featurep 'migemo))
      source
    (let* ((match-identity-p 
            (or (assoc 'candidates-in-buffer source)
                (equal '(identity) (assoc-default 'match source))))

           (matcher 'helm-mp-3migemo-match)
           (searcher (if (assoc 'search-from-end source)

                           'helm-mp-3migemo-search-backward
                         'helm-mp-3migemo-search)))
      (cond (helm-use-migemo
             `((delayed)
               (search ,@(assoc-default 'search source) ,searcher)
               ,(if match-identity-p
                    '(match identity)
                  `(match ,matcher ;; helm-string-match-with-migemo))
                          ,@(if (eq (cdr (assoc 'match source)) 'helm-buffers-list--match-fn)
                               '(helm-string-match-with-migemo)
                              (assoc-default 'match source))))
               ,@source))
            ((assoc 'migemo source)
             `((search ,searcher)
               ,(if match-identity-p
                    '(match identity)
                  `(match ,matcher))
               ,@source))
            (t source)))))
(add-to-list 'helm-compile-source-functions 'helm-compile-source--migemo t)

なんかその場限りの解決ですけれども。

でもう一つの偽りの解決というのは helm-buffers-list--match-fn がかなり労作の関数なんですね。
なんかバッファのモードで絞り込めるようにコメントが書かれているのです。でもhelm-migemoの環境ではそれも動作しない。

なので、偽りの解決とは承知しつつ、バッファの名前だけでmigemoが使えればいいやと割り切りました。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4