Closed pierre-rouleau closed 1 year ago
@bling I tested that code on Emacs 28.2, and 26.3. I believe it's ready for integration. Let me know if you notice something wrong.
@bling I have also tested the new customization. I believe everything is good to go.
Changed the file name and line number extraction logic of a grep-like operation to use Emacs Lisp regular expression, allowing extraction of file names with any embedded characters (including colons) while also allowing user code to override the regular expression and the matching groups used to extract the file and line numbers.
Add a new command,
fzf-hg-grep
, which produces a FILE:REV:LINE:text output and therefore requires a different regexp/matching groups to extract the file name and line numbers.Provide extraction expressions in a 3-item list of format described in
fzf--extractor-list
doctring. The extraction for grep uses thefzf--file-lnum-regexp
regexp, while extraction for hg grep uses thefzf--file-rnum-lnum-regexp
regexp.Users can also override the extraction list: the calling function can let-bind the variable
fzf-extractor-list
to a valid 3-member list. That variable is unbound by default.Users can also override the target validation function: the calling function can *let-bind8 the `fzf-target-validator' to a function performing validation. That variable is unbound by default.
Also added documentation.
All fzf commands now work with files names with embedded colons. All valid file names for the OS should be accepted.
Better
fzf/grep-command
customization with grep and ripgrep options: Thefzf/grep-command
defcustom now takes advantage of Emacs Lisp powerful customization UI control. It provides 3 options: grep, ripgrep and something else. grep and ripgrep include default command lines, while the third option is blank and must be filled. The user can also modify the grep and ripgrep command line. Emacs will remember the 3 command lines independently and will allow switch from one to another.Tested.
I believe this address the issue reported by https://github.com/bling/fzf.el/pull/51 in a way that will be more flexible if the user wants to use tools that produce a different output than FILE:LINE:text.