LoginSignup
1
1

More than 5 years have passed since last update.

file-cacheのリストをクリアしてもanything / helmが追随してくれない

Posted at

毎度毎度 Emacs の話しか投稿してない old type の hage ですw

anything / helm (今後このエントリではこれらを helm で代表させます) のfile-cache 情報源 (anything-c-source-file-cache / helm-source-file-cache) は最初に起動されたときに file-cache のリストから独自のリストを作ってそちらで管理しています。

helm は file-cache-add-file に関してはケアしていますが (file-cache にファイルが追加されたら helm のリストにも追加される)、file-cache-clear-cache に関してはノーケアです。

私は file-cache-clear-cache で一度リストをクリアして構築し直すことをよくやりますが、そうすると helm を開くと同じファイルがずらずらと並んだりします…。それまでの内容がクリアされずに同じファイル名が登録されるわけだから当然ですね。

しかしそれだと困るので file-cache-clear-cache をしたときに同時に helm が隠し持ってるリストもクリアするようにしました。ただ helm や anything の変数を直接いじっているのでバージョンがあがるとダメになる可能性があります。

init.el
;; helm用
(defadvice file-cache-clear-cache (after helm-advice-file-cache-clear-cache activate)
  (setq helm-file-cache-initialized-p nil)
  (setq helm-file-cache-files nil))
;; anything用
(defadvice file-cache-clear-cache (after anything-advice-file-cache-clear-cache activate)
  (setq anything-c-file-cache-files nil))
1
1
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
1
1