unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ergus <spacibba@aol.com>
To: "andrés ramírez" <rrandresf@gmail.com>
Cc: "João Távora" <joaotavora@gmail.com>, emacs-devel@gnu.org
Subject: Re: about fido-mode
Date: Tue, 8 Sep 2020 10:08:05 +0200	[thread overview]
Message-ID: <20200908080805.yq5nywywj2gen3ng@Ergus> (raw)
In-Reply-To: <865z8p2qay.fsf@gmail.com>

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.



  parent reply	other threads:[~2020-09-08  8:08 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07 16:45 A new user perspective about "Changes for emacs 28" Nicola Manca
2020-09-07 18:08 ` Ergus
     [not found]   ` <86d02x2yg0.fsf@gmail.com>
2020-09-07 19:59     ` about fido-mode Ergus
2020-09-07 20:44       ` andrés ramírez
2020-09-07 21:09         ` Ergus
2020-09-07 21:18           ` andrés ramírez
     [not found]     ` <87mu21wd3f.fsf@gmail.com>
     [not found]       ` <20200907214104.kapyivsh5y62wcl5@Ergus>
     [not found]         ` <865z8p2qay.fsf@gmail.com>
2020-09-08  8:08           ` Ergus [this message]
2020-09-08  9:06             ` andrés ramírez
2020-09-08  9:26               ` Ergus
2020-09-08 16:14                 ` andrés ramírez
2020-09-08 16:25                   ` Ergus
2020-09-09  2:44                     ` andrés ramírez
2020-09-07 20:05   ` A new user perspective about "Changes for emacs 28" Dmitry Gutov
2020-09-07 20:34     ` Drew Adams
2020-09-07 20:46       ` Dmitry Gutov
2020-09-07 21:11         ` Drew Adams
2020-09-07 21:15           ` Dmitry Gutov
2020-09-07 21:39             ` Drew Adams
2020-09-07 21:50               ` Dmitry Gutov
2020-09-08  2:54             ` Richard Stallman
2020-09-08 11:10               ` Dmitry Gutov
2020-09-08  6:18         ` Alfred M. Szmidt
2020-09-08 11:07           ` Dmitry Gutov
2020-09-08 14:20           ` Eli Zaretskii
2020-09-08 14:54             ` Alfred M. Szmidt
2020-09-08 15:14               ` Amin Bandali
2020-09-08 15:53                 ` Alfred M. Szmidt
2020-09-08 16:18                   ` Thibaut Verron
2020-09-08 16:28                     ` Ergus
2020-09-08 15:27               ` Óscar Fuentes
2020-09-08 15:36                 ` Eli Zaretskii
2020-09-08 15:27               ` Eli Zaretskii
2020-09-08 16:13                 ` Thibaut Verron
2020-09-08 16:23                   ` Eli Zaretskii
2020-09-08 18:00                     ` Thibaut Verron
2020-09-09  3:44               ` Richard Stallman
2020-09-09 19:01                 ` Alfred M. Szmidt
2020-09-09 19:07                   ` Eli Zaretskii
2020-09-09 21:43                     ` Dmitry Gutov
2020-09-08 15:02             ` Dmitry Gutov
2020-09-08 15:28               ` Eli Zaretskii
2020-09-08 21:31                 ` Dmitry Gutov
2020-09-10  7:23                   ` Jack Kamm
2020-09-10 14:52                     ` Howard Melman
2020-09-10 15:01                       ` Jack Kamm
2020-09-10 16:43                         ` Vasilij Schneidermann
2020-09-09  5:03                 ` Arthur Miller
2020-09-09  8:35                   ` Ergus
2020-09-09  8:41                     ` tomas
2020-09-09 10:00                       ` Ergus
2020-09-09 10:36                         ` tomas
2020-09-09 13:49                           ` Arthur Miller
2020-09-09 14:36                           ` Eli Zaretskii
2020-09-09 15:54                             ` tomas
2020-09-10  2:38                           ` Richard Stallman
2020-09-10 12:10                             ` Robert Pluim
2020-09-11  4:16                               ` Richard Stallman
2020-09-09 18:39                         ` Juri Linkov
2020-09-10 12:28                           ` Ricardo Wurmus
2020-09-09 13:17                     ` Arthur Miller
2020-09-10  2:40                     ` Richard Stallman
2020-09-11 10:29                   ` Dmitry Gutov
2020-09-11 11:29                     ` Arthur Miller
2020-09-11 11:40                       ` Ergus
2020-09-11 14:53                         ` Jack Kamm
2020-09-11 15:03                           ` Ergus
2020-09-11 15:16                             ` Eli Zaretskii
2020-09-11 20:51                               ` Dmitry Gutov
2020-09-12 13:02                             ` Arthur Miller
2020-09-12 13:09                               ` Dmitry Gutov
2020-09-13 22:13                                 ` chad
2020-09-13 22:44                                   ` Dmitry Gutov
2020-09-15  4:34                                   ` Richard Stallman
2020-09-15  6:54                                     ` Alfred M. Szmidt
2020-09-11 12:27                       ` Dmitry Gutov
2020-09-11 15:08                         ` Arthur Miller
2020-09-11 20:35                           ` Dmitry Gutov
2020-09-11 13:51                       ` Stefan Monnier
2020-09-11 14:32                         ` Stefan Monnier
2020-09-11 14:59                           ` Jack Kamm
2020-09-12 12:55                           ` Arthur Miller
2020-09-11 13:15                     ` Alfred M. Szmidt
2020-09-11 14:37                       ` Dmitry Gutov
2020-09-08 16:37     ` Custom Et Al: Build-Up The Underlying Platform was " T.V Raman
2020-09-08 20:40       ` Daniel Martín
2020-09-09  3:51         ` Richard Stallman
2020-09-09  8:48           ` Tim Cross
2020-09-09 15:53             ` Drew Adams
2020-09-09 16:36               ` Ergus
2020-09-09 16:41                 ` T.V Raman
2020-09-09 17:05                   ` Ergus
2020-09-09 14:32           ` T.V Raman
2020-09-09 18:44             ` Juri Linkov
2020-09-11  4:11             ` Richard Stallman
2020-09-07 18:16 ` Ergus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200908080805.yq5nywywj2gen3ng@Ergus \
    --to=spacibba@aol.com \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=rrandresf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).