This command creates a new p-search session and displays its buffer. The default session that is created is specified by the variable p-search-default-command-behavior
.
If called with a prefix argument C-u, it will create an empty session regardless of how p-search-default-command-behavior
is defined.
This variable’s value determines the default behavior when running
p-search
(i.e. which candidate generators should the session be
initialized with). It can take the following values:
t
Use the default behavior. If the current default-directory
is
a project (see Projects in GNU Emacs manual), initialize the session with a filesystem
candidate generator on the project’s root. Otherwise initialize the
session in the current default-directory
. The default behavior
is subject to change.
nil
Always initialize the session empty with no candidate generators.
Initialize the session with the candidate generator (See Creating Candidate Generators), provided with arguments. E.g. (cons p-search-candidate-generator-filesystem '((base-directory . "~/dev/emacs")))
If a preset plist is provided, initialize the session with the provided preset. Presets are a way of defining p-search sessions with data, The Preset Data Structure and Programatically Creating Sessions.
Call the provided function to obtain the session’s initial candidate generator. The function should take no arguments and return either a cons cell or preset plist as described above.
You can utilize dir-local variables to have different setups in different directories. The following is an example of a dir-local entry to setup this variable using a preset plist.
((p-search-mode . ((p-search-default-command-behavior . (:candidate-generator p-search-candidate-generator-filesystem :args ((base-directory . (lambda () (expand-file-name (project-root (project-current)))))))))))