/find-project.el

find project

Primary LanguageEmacs Lisp

find-project.el

easily finds your projects


License GPLv2

Before using the package you must specify patterns of your project paths. For example:

(setq find-project-patterns
      '("~/.emacs.d"
        "~/.emacs.d/site-lisp/*"
        "~/projects/*"
        "~/work/*/*"))

Now if you call M-x find-project all matching projects will show up. After you choose the project find-project-default-action will be executed which is by default a list of pre-defined actions like magit or dired.

You can customize default action by specifying a list of actions:

(setq find-project-default-action '(find-file-in-repository find-file))

Or a single action:

(setq find-project-default-action 'magit-status)

in which case it will be executed immediately.

You can customize completion functions for projects and actions separately:

(setq find-project-completing-read-projects 'ivy-completing-read)
(setq find-project-completing-read-actions 'ido-completing-read)

Examples of valid completing functions are completing-read, ido-completing-read, helm-comp-read, ivy-completing-read.

You can have more fine-grained control of where your projects are located and what actions to execute by using the property list in patterns:

(setq find-project-patterns
      '((:pattern "~/.emacs.d/site-lisp/*" :action find-file)
        (:function (find-project-traverse "~/projects/" 1 ".git") :action magit-status)
        (:pattern "~/work/*/*" :exclude "~/work/*hat/*")))

Valid properties are :pattern, :function, :exclude and :action.

:function can be used when wildcards are not sufficient to find your projects' locations. The value must be a function or a list whose car is a function and cdr are arguments.

:exclude can be used for filtering out some directories. It can be a wildcard, list of wildcards or a function accepting directory as an argument.

In find-project-patterns you can mix both wildcards and plists.

Global project filter can be provided via find-project-exclude:

(setq find-project-exclude "*/.*")

find-project-exclude can accept the same types as :exclude.

By default, recently selected projects are suggested first. You can disable this behavior by adding this line to your Emacs config:

(setq find-project-recent-first nil)

Function Documentation

(find-project-traverse DIRECTORY MAX-DEPTH &rest FILENAMES)

Recursively traverse DIRECTORY up to level of MAX-DEPTH returning list of directories containing at least one file from FILENAMES. If MAX-DEPTH is nil it's considered that there is no depth limit.

(find-project)

Select a project from find-project-patterns and run action on it.


Markdown README file generated by make-readme-markdown.el