[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: about fido-mode
From: |
Ergus |
Subject: |
Re: about fido-mode |
Date: |
Tue, 8 Sep 2020 10:08:05 +0200 |
On Mon, Sep 07, 2020 at 10:08:21PM +0000, andr�s ram�rez wrote:
Hi. Ergus.
Ergus> Actually I am interested a bit on this specific one because so far
the ido-imenu function
Ergus> you shared with me is an ido wrapper around imenu completion. But as
icomplete/fido uses
Ergus> the internal infrastructure it shouldn't be needed this hack.
Right.
Ergus> OTOH (from my absolute ignorance about ido-imenu), I tried imenu+fido
and it works like a
Ergus> charm. Probably the only missing thing is the sorting part?
It is not the same. ido-imenu shows just the functions, not de 'Class' or
'Fields'. one less thing to pick. Just go directly to the
functions. Actually I need to comment this imenu is so awesome. It is
present on vanilla emacs. Probably others editors do not have it present
by default, without needing a plugin or package.
If course it is not the same. Look at the code. Actually What it list
are the symbols not only the functions.
Ergus> In the code you shared I only see that you need to replace the
ido-completing-read with
Ergus> something else.
There was a issue when trying ido-imenu with eglot activated. The error was this
one:. I have been trying to create a git-issue without success from within
emacs. So I am going to report later the complete case:
I don't care at all about ido (as a radical I consider that ido should
be removed in favor of ivy, helm, and anything else better supported and
integrated with the actual infrastructure... that's why I support fido)
Any way, in general I think that this (untested) code could do the work
in fido-mode:
;; Same flet code in your function
(defun my-filter (symbol-list)
(let (name position name-and-pos)
(dolist (symbol symbol-list)
(setq name nil
position nil)
(cond
((listp symbol)
(if (imenu--subalist-p symbol)
(addsymbols symbol)
(setq name (car symbol))
(setq position (cdr symbol))))
((stringp symbol)
(setq name symbol)
(setq position (get-text-property 1 'org-imenu-marker symbol))))
(when (and position name)
(add-to-list 'name-and-pos (cons name position))))
name-and-pos))
;; Filter the aoutput of imenu--make-index-alist
(advice-add 'imenu--make-index-alist :filter-return #'my-filter)
Basically the point is that imenu calls imenu--make-index-alist to
create the candidates list and it can have many symbols and nested
elements. But you want a simplified flatten list of symbol only
candidates.
With this advise you process the output imenu--make-index-alist to
return a flatten alist of symbols only. (it is exactly the same function
you had declared with flet, but simpler)
Then imenu could do what you want.
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", (continued)
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", Daniel Martín, 2020/09/08
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", Richard Stallman, 2020/09/08
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", Tim Cross, 2020/09/09
- RE: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", Drew Adams, 2020/09/09
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", Ergus, 2020/09/09
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", T.V Raman, 2020/09/09
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", Ergus, 2020/09/09
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", T.V Raman, 2020/09/09
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", Juri Linkov, 2020/09/09
- Re: Custom Et Al: Build-Up The Underlying Platform was Re: A new user perspective about "Changes for emacs 28", Richard Stallman, 2020/09/11
- Message not available
- Message not available
- Message not available
- Message not available
- Re: about fido-mode,
Ergus <=
- Re: about fido-mode, andrés ramírez, 2020/09/08
- Re: about fido-mode, Ergus, 2020/09/08
- Re: about fido-mode, andrés ramírez, 2020/09/08
- Re: about fido-mode, Ergus, 2020/09/08
- Re: about fido-mode, andrés ramírez, 2020/09/08
Re: A new user perspective about "Changes for emacs 28", Ergus, 2020/09/07