Add ability to specify a set of extra directories to search#163
Open
pierre-rouleau wants to merge 7 commits intoWilfred:masterfrom
Open
Add ability to specify a set of extra directories to search#163pierre-rouleau wants to merge 7 commits intoWilfred:masterfrom
pierre-rouleau wants to merge 7 commits intoWilfred:masterfrom
Conversation
Add the deadgrep-extra-searched-directories user-option.
- That's an association list:
- key := directory context : a string identifying a directory context
- value := list of directories to search when the directory context is
selected in the Directory field.
By default this is nil, and deadgrep continues to behave as before.
If deadgrep-extra-searched-directories holds something and inside there's a
key that is equal to the default-directory, then the ripgrep command line
is set to search the directory/ies identified in the list associated with the
alist elment value.
If no key match the default-directory, deadgrep uses "." as before and ends up
behaving as before.
This provides the ability to set up a list of directory contexts to pre-define
the directories that are effectively searched by deadgrep. The real
advantage is that this list can contain a set of non-overlapping directories
to search (and the original directory if that's needed), something like /etc
and /usr for example.
It works with Tramp syntax as well, as long as the user reads the description
in the customization buffer when entering the paths of the extra directories.
Ensures that dir name comparison is done on fully expanded directories, allowing ~ in the names placed in the customized list.
- The check for directory context treats the Context Directory as a directory tree; searching inside any of it's sub-directory will include the context. - The context directory is now include in the search by default. However the user can explicitly excluded it via customization. - Improved the description of the `deadgrep-extra-searched-directories' user-option. Also added tags to provide information in the customize buffer during data entry.
The use of context-based extra directories was always added in the last instance of the code instead of being included only when the extra context directory matched the current directory as the intent was.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the
deadgrep-extra-searched-directoriesuser-option.By default
deadgrep-extra-searched-directoriesis nil, and deadgrep continues to behave as before.If
deadgrep-extra-searched-directoriesholds something and inside there's a key that is equal to the default-directory, then the ripgrep command line is set to search the directory/ies identified in the list associated with the alist element value.If the default-directory does not match any identified directory context (or is one of the sub-directory of an identified directory context), deadgrep uses "." as before and ends up behaving as before.
This provides the ability to set up a list of directory contexts to pre-define the directories that are effectively searched by deadgrep. The real advantage is that this list can contain a set of non-overlapping directories to search (and the original directory if that's needed), something like /etc and /usr for example.
It works with Tramp syntax as well, as long as the user reads the description in the customization buffer when entering the paths of the extra directories.
This is one way of addressing #162
@Wilfred I think what is inside the commits of this PR is complete. I have been using it and all works fine.
The code added in inside
deadgrep--argumentswhich deals with possible entries indeadgrep-extra-searched-directoriesuser-option`.