emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: João Távora
Subject: Re: master e1d24f3 1/2: New fido-mode, emulates ido-mode with icomplete-mode
Date: Mon, 9 Dec 2019 00:59:19 +0100

On Mon, Dec 9, 2019 at 12:45 AM Dmitry Gutov <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]