Re: master e1d24f3 1/2: New fido-mode, emulates ido-mode with icomplete-mode

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: master e1d24f3 1/2: New fido-mode, emulates ido-mode with icomplete-mode

Dmitry Gutov
Hi Joao!

On 06.11.2019 1:01, Jo�o T�vora wrote:
> New fido-mode, emulates ido-mode with icomplete-mode

This looks pretty rad!

As a fellow Ido addict, it seems the only things I'm really missing is a
lower idle delay (already configurable) and different coloring for
directories when entering a file name.

Reply | Threaded
Open this post in threaded view
|

Re: master e1d24f3 1/2: New fido-mode, emulates ido-mode with icomplete-mode

João Távora
On Mon, Dec 9, 2019 at 12:45 AM Dmitry Gutov <[hidden email]> wrote:
>
> Hi Joao!
>
> > New fido-mode, emulates ido-mode with icomplete-mode
>
> This looks pretty rad!

Thanks Dmitry, really glad you like it.

And I'm also glad you mention the missing bits, because it gives me the
opportunity to add some more things to that list.

1. Yes it probably needs those two things (though the current idle delay
seems OK for me).

2. Another thing it needs is to simplify how you display the already
matched candidate.  Sometimes some weird {...} will show up that I can't
interpret.  Again, I just want it to work like ido.

3. It needs to remember entered directory history, again just like ido
(or at least I remember ido used to do that).

Don't have a good plan how to do this yet.

4. it needs to be able to C-x f history-fragment M-p M-p ...

This last one is proving extremely challenging. I want to do it with
reverse isearch, instead of reinvent the wheel, of course.  It seems
within reach because if I do C-x f C-M-r history-fragment C-r C-r I get
what i want.  But of course fido's mission is to do it just like ido.

The problem I'm having is how to simulate pasting the history-fragment
bit after I start a reverse isearch.  There are no hook., I've tried
timers, internal isearch variables, always failed.

Who can help me?  Here's what I have:

(defun icomplete--category ()
  (let* ((beg (icomplete--field-beg))
         (md (completion--field-metadata beg)))
    (alist-get 'category (cdr md))))

(defun icomplete-fido-previous-input (n)
  "Recall previous input or start a reverse-isearch."
  (interactive "p")
  (let* ((field-string (icomplete--field-string))
         (isearch-initial-string (and (eobp)
                             (if (eq (icomplete--category) 'file)
                                 (file-name-nondirectory field-string)
                               field-string))))
    (cond ((or (null isearch-initial-string)
               (string-empty-p isearch-initial-string))
           (previous-history-element n))
          (t
           (delete-region (- (point-max) (length isearch-initial-string))
                          (point-max))
           ;; How to I make `isearch-backward' start with
           ;; `isearch-initial-string'????
           (isearch-backward)))))

João

Reply | Threaded
Open this post in threaded view
|

Re: master e1d24f3 1/2: New fido-mode, emulates ido-mode with icomplete-mode

Dmitry Gutov
On 09.12.2019 1:59, João Távora wrote:

> 1. Yes it probably needs those two things (though the current idle delay
> seems OK for me).

I think the thing that irks me is that display updates twice
(particularly, the mode-line jumps up on the second update): first when
only the prompt is shown, and then when the list of completions is
added. Indeed, that cannot be solved by a different value of idle delay
alone, and otherwise that value is fine.

> 2. Another thing it needs is to simplify how you display the already
> matched candidate.  Sometimes some weird {...} will show up that I can't
> interpret.  Again, I just want it to work like ido.

We might need an example here. (Cannot reproduce.)

> 3. It needs to remember entered directory history, again just like ido
> (or at least I remember ido used to do that).
>
> Don't have a good plan how to do this yet.

Doesn't it? Pressing 'M-p' during file-file rotates me through some
directories.

> 4. it needs to be able to C-x f history-fragment M-p M-p ...

Did you mean 'C-h f ...'?

> This last one is proving extremely challenging. I want to do it with
> reverse isearch, instead of reinvent the wheel, of course.  It seems
> within reach because if I do C-x f C-M-r history-fragment C-r C-r I get
> what i want.  But of course fido's mission is to do it just like ido.

I might need a step-by-step scenario to understand what's the idea here,
and what doesn't work.

But FWIW, it sounds like a capability of Ido that I've never used before.