bling / fzf.el

A front-end for fzf
GNU General Public License v3.0
360 stars 50 forks source link

Issue #84 Fix. Also fixes issue #82. #86

Closed pierre-rouleau closed 1 year ago

pierre-rouleau commented 1 year ago

Fixes:

'fzf/after-term-handle-exit' now detect extra spaces or other characters at the end of the file name returned by extraction of fzf output.

This occurs since fzf 0.35.1 as reported by issue #82 because of a new separator line. But instead of modifying the command line the function trims any whitespace at the end of the file name. If the resulting file name is not found it tries to extract the correct file name by removing characters at the end until a valid filename is found. If it does not find any valid file name it then issues a descriptive message to provide enough info for further improvements.

Also included fix for issue #87 as well as other cleanup:

The following functions are no longer interactive: they can't be used interactively:

Also: fzf-close is no longer interactive. It really is an internal function.

Other fixes:

pierre-rouleau commented 1 year ago

@bling : Don't merge in that code until I fix a regression introduced by my first fix: the code I wrote only handles validating and adjusting file names not anything as possibly requested by other public functions. I'm in the process of changing the code to make it more versatile and allow the use of a user-specified validator/filter function used by the lambda created by the after-term-handle-exit function to support all other operations.

pierre-rouleau commented 1 year ago

@bling : My last commit:

I also left a TODO note to add ability to customize minor mode deactivation during the FZF processing, a possible improvement.

I tested all commands and they all work with the changes on Emacs 26.3. Will test on Emacs 27.2 and 28.2 soon. I'm using the latest fzf built from source on macOS and various Linux distributions.

pierre-rouleau commented 1 year ago

@bling Do you want me to do something else to this commit stream before you can merge it in? Thanks

bling commented 1 year ago

@pierre-rouleau your previous comment said u were gonna test against 27.2/28.2 soon so was waiting on confirmation for that.

pierre-rouleau commented 1 year ago

@Bling, sorry for that. I did test on both Emacs 27.2 and Emacs 28.2. I've even tested on Emacs 28.2 running on remote site accessed over ssh inside a GNU screen session over a huge directory tree. They all worked fine. The one over ssh was a bit slower as expected but still very fast. I tested Emacs 28.2 only on Linux. I tested the others on Linux and macOS. Did not test on Windows or other *Nix OSes.

The way you're using the inferior process directly is really the way to go. I had been using counsel-fzf before but it collects the files in a list before passing it to the prompt which makes it stall Emacs when processing over large directory trees.