Add functions to increment/decrement context#161
Open
ethan-coe-renner wants to merge 1 commit intoWilfred:masterfrom
Open
Add functions to increment/decrement context#161ethan-coe-renner wants to merge 1 commit intoWilfred:masterfrom
ethan-coe-renner wants to merge 1 commit intoWilfred:masterfrom
Conversation
These functions can then be bound to keys to quickly increase and decrease before/after context in the current search.
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.
Thanks for this great package, I use it daily!
I wanted to be able to increase/decrease the before/after context via keybindings rather than clicking through the buttons in the header of a deadgrep buffer. I didn't see a way to do this with the functions
deadgrepcurrently exposes, so I wrote my own. I figure others might find this useful, so this PR includes that code.(Please let me know if I've missed something and this functionality already exists).
New Functions
deadgrep--update-contextdoes most of the work. It takes a string (which-context, which can be either "before" or "after") and an integer (value). The function updates the context denoted bywhich-contextby addingvalueto the appropriate field indeadgrep--context, after ensuring that doing so won't result in a negative value.A family of interactive functions named
deadgrep-<increment/decrement>-<before/after>-contextare implemented to usedeadgrep--update-contextto increment/decrement the before/after context by 1 line. These are intended to be bound to keys.Keybindings
I've not added any keybindings to the
deadgrep-mode-map, but in my configuration I use the following hydra:I'm happy to add default keybindings if that is desired and suggestions are welcome for such keybinds.
Note: This is my first non-trivial elisp contribution to an emacs package, so please let me know if there's anything here that needs to be changed, I'm happy to do it.