1

I need to find all *.txt files in the directory, like

find ./ -iname "*txt"

I wanted an Emacs solution, so I found the multi-command icicle-locate-file-other-window.

Its documentation tells me to type a multi-completion pattern to match

f.* C-M-j some text .* in the file

Nothing happens when I press C-M-j. What command is this bound to?

I also know about find-name-dired, but I want to try this Icicles thingy ;).

1 Answer 1

1

icicle-locate-file(-other-window) allows (but doesn't require) multi-completion input matching.

In your example you apparently just want to find all files whose ''names'' match *.txt, so you don't provide a second pattern, to match file content, at all. You just type .*\.txt S-TAB, that is, a regexp matching the file name, followed by S-TAB for apropos (regexp-matching) completion.

But if you ''do'' want to also match file ''content'' then you use C-M-j to tell Icicles that your first, file-name-matching pattern is finished and you next will type a file-content-matching pattern.

(Unless you've set option icicle-show-Completions-initially-flag to non-nil, you need to tell Emacs to show completions, at least initially, using TAB or S-TAB. And if you do want to match more than just the first part then use S-TAB.)

To match multiple parts, you use C-M-j after each input pattern for a part. What that does is insert a string that separates the patterns - ''nothing more''. (C-M-j is bound during minibuffer completion to command icicle-insert-list-join-string.)

By default, the separator string is the two chars ^G (Control G) followed by ^J (Control J, aka ''newline''). You could enter the string chars yourself, if you wanted, instead of using C-M-j -- to insert a Control-G char you need to use C-q C-g. (In Icicles, C-j/newline is self-inserting.)

This odd separator string is the default because (1) the newline char gives you a new minibuffer line for each pattern and (2) it's very unlikely that any of your patterns will contain such a string. (You don't see the ^G character because it's hidden.) Contrast this with completion frameworks that use SPC, which doesn't let you use space chars in patterns. You can customize the separator string, using option icicle-list-join-string. (And some Icicles commands, such as icicle-search, bind it to a simpler string, such as "^I" (just a TAB char) or ": ".

This part of the Nutshell View of Icicles gives a simple overview of using multicompletion. This topic presents multicompletion in detail. This topic tells you about commands, such as icicle-locate-file, that read file names. And this topic tells you about using multicompletion with such commands, to match both file names and file content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.