[-- Attachment #1: Type: text/plain, Size: 1717 bytes --] Emacs fido-mode (which is part of icomplete-mode) implements minibuffer completion system which offers quick and easy way to choose one of the available options. However, sometimes user needs to enter a different substring which is not any of the available options. Sometimes even empty string is needed. This seems to be impossible in fido-mode. The following example demonstrates the empty string problem. 1. Save the attached (inline) file "test.org". 2. Start Emacs and open the file: emacs -Q test.org 3. Ensure that the major mode is org-mode and turn on fido-mode: M-x org-mode M-x fido-mode 4. Press "C-c C-c" (org-ctrl-c-ctrl-c) on any of the Org heading lines. The command will start editing tags for the current heading line. The available tags in the buffer are :one:, :two:, :three:. 5. Try to clear the prompt from any tags. This works but it seems to be impossible to actually enter empty string because one of the buffer's present tags are always chosen when user finishes the prompt with RET key. A work-around in org-mode's tag completion prompt is to enter one colon (:) in the prompt but this is not general solution to the empty string problem. Another difficulty comes with entering just a substring of available matches. The following example demonstrates this. 1. Start Emacs with "emacs -Q". 2. Turn fido-mode on. M-x fido-mode 3. Press "C-x b" (switch-to-buffer) and try to create buffer named "scr" which is a substring of "*scratch*" buffer. This seems to be impossible or there is no documented way to do this. -- /// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: test.org --] [-- Type: text/x-org, Size: 234 bytes --] * first :one: * second :two: * third :three:
On 2020-10-03, 09:30 +0300, Teemu Likonen <tlikonen@iki.fi> wrote:
> Emacs fido-mode (which is part of icomplete-mode) implements minibuffer
> completion system which offers quick and easy way to choose one of the
> available options. However, sometimes user needs to enter a different
> substring which is not any of the available options. Sometimes even
> empty string is needed. This seems to be impossible in fido-mode. The
> following example demonstrates the empty string problem.
>
> [..]
Hi Teemu,
Try to use C-j (icomplete-force-complete-and-exit) to insert a substring
that is not part of the list of candidates.
A simple reproducible recipe (I am on Emacs 28.0.50):
+ Start 'emacs -Q'
+ In the scratch buffer first evaluate:
(fido-mode 1)
+ Then evaluate:
(insert
(completing-read "Test arbitrary input: " '(one two three)))
+ Instead of selecting among {one,two,three} you can type any string,
such as "test" and add it with C-j. Your input shall be inserted at
point.
This should work for a substring, but I am not sure it does for an empty
string.
--
Protesilaos Stavrou
protesilaos.com
[-- Attachment #1: Type: text/plain, Size: 870 bytes --] * 2020-10-04 10:18:34+03, Protesilaos Stavrou wrote: > Try to use C-j (icomplete-force-complete-and-exit) to insert a > substring that is not part of the list of candidates. It doesn't work with my test cases. C-j in fido-mode selects the current option, not the typed (sub)string. I have switched to plain icomplete-mode. It is quite close to fido-mode when used with these settings: (setq completion-styles '(flex) read-file-name-completion-ignore-case t read-buffer-completion-ignore-case t) Plain icomplete-mode has a way to choose only the typed string (RET), a way to choose the suggested option and exit (C-j), and a way to complete the string to the suggested option (C-M-i), plus some other things. -- /// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 251 bytes --]
Teemu Likonen <tlikonen@iki.fi> writes: > * 2020-10-04 10:18:34+03, Protesilaos Stavrou wrote: > >> Try to use C-j (icomplete-force-complete-and-exit) to insert a >> substring that is not part of the list of candidates. > > It doesn't work with my test cases. C-j in fido-mode selects the current > option, not the typed (sub)string. Yes, there seems to be no way to select the empty string in fido-mode with C-j, as far as I can tell (with your test case). -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
On 04.10.2020 11:24, Teemu Likonen wrote:
> Plain icomplete-mode has a way to choose only the typed string (RET), a
> way to choose the suggested option and exit (C-j), and a way to complete
> the string to the suggested option (C-M-i), plus some other things.
Have you tried 'M-j' in fido-mode?