redguardtoo / find-file-in-project

Quick access to project files in Emacs
GNU General Public License v3.0
428 stars 57 forks source link

Would it be possible to prevent search in given folders #133

Closed avatar-lavventura closed 3 years ago

avatar-lavventura commented 3 years ago

Would it be possible to prevent search in given folders such as .git, .mypy_cache/

Pasted Graphic

For example I don't want to see find files under .mypy_cache, if possible.

redguardtoo commented 3 years ago

ffip-prune-patterns

avatar-lavventura commented 3 years ago

I have tried:

(defun my-setup-develop-environment ()
  (interactive)
  (add-to-list 'ffip-prune-patterns "*/.mypy_cache"))

but it did not help :(

redguardtoo commented 3 years ago

It works on my computer.

Please note ffip-prune-patterns is buffer local variable. You need run this command in the same buffer where youl trigger ffip command.

Or you can set ffip-prune-patterns in major mode hook.

Or check README to how to set up it in .dir-locals.el

Or just (setq-default ffip-prune-patterns (add-to-list 'ffip-prune-patterns "*/.mypy_cache")) in your ~/.emacs. See https://www.gnu.org/software/emacs/manual/html_node/elisp/Default-Value.html

avatar-lavventura commented 3 years ago

For (setq-default ffip-prune-patterns (add-to-list 'ffip-prune-patterns "*/.mypy_cache")) , I am getting following error message is it normal:

Debugger entered--Lisp error: (void-variable ffip-prune-patterns)
  (member "*/.mypy_cache" ffip-prune-patterns)
  (if (member "*/.mypy_cache" ffip-prune-patterns) ffip-prune-patterns (setq ffip-prune-patterns (cons "*/.mypy_cache"
ffip-prune-patterns)))
  (set-default 'ffip-prune-patterns (if (member "*/.mypy_cache" ffip-prune-patterns) ffip-prune-patterns (setq ffip-prune-patterns
(cons "*/.mypy_cache" ffip-prune-patterns))))
  eval-buffer(#<buffer  *load*> nil "/home/alper/.emacs" nil t)  ; Reading at buffer position 101501
  load-with-code-conversion("/home/alper/.emacs" "/home/alper/.emacs" t t)
  load("~/.emacs" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1556d8273e85>) #f(compiled-function () #<bytecode
0x1556d828ecf9>) t)
  command-line()
redguardtoo commented 3 years ago
(with-eval-after-load 'find-file-in-project
  (setq-default ffip-prune-patterns (add-to-list 'ffip-prune-patterns "*/.mypy_cache")) )