From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: about fido-mode Date: Tue, 8 Sep 2020 10:08:05 +0200 Message-ID: <20200908080805.yq5nywywj2gen3ng@Ergus> References: <1ca462fa-0f9e-3c18-6386-f43f49388b2f@gmail.com> <20200907180812.5tfylspp7i6vl4o3@Ergus> <86d02x2yg0.fsf@gmail.com> <87mu21wd3f.fsf@gmail.com> <20200907214104.kapyivsh5y62wcl5@Ergus> <865z8p2qay.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18000"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= , emacs-devel@gnu.org To: =?utf-8?Q?andr=C3=A9s_ram=C3=ADrez?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 08 10:08:47 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFYgJ-0004b2-6f for ged-emacs-devel@m.gmane-mx.org; Tue, 08 Sep 2020 10:08:47 +0200 Original-Received: from localhost ([::1]:40708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFYgI-0001GO-99 for ged-emacs-devel@m.gmane-mx.org; Tue, 08 Sep 2020 04:08:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFYfn-0000o9-Mx for emacs-devel@gnu.org; Tue, 08 Sep 2020 04:08:15 -0400 Original-Received: from sonic313-15.consmr.mail.bf2.yahoo.com ([74.6.133.125]:38345) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFYfk-0008Du-8n for emacs-devel@gnu.org; Tue, 08 Sep 2020 04:08:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1599552489; bh=m9nvPLxnuB7dkj0AkudhF/E/DEM6YaWzk/hEjy5++v8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=KVcVWTNZWvlJziAZqRalQK449OytAQVrRFec6mzOk5qpqyLAeu/++oiZjdM3gUHfyE35eCY9pdIdCgD1kYDUpeZLNUb2M2NKFMRUumXy7Msbw5Th0AjBvQWBeaQj+7rPcD6u9SUyBvrKVVDLTMk+0JrXx15wWpxd9xeMpfWGFxxZlKYgelZPFTADClxwPedEOD8nxr6cohZHD7TStcn3ZKcl4bVCg1UNU7TVgH7ES83s6Lh5e8+/P0KXvnEsFgIPC5Lo2tk6lMB87donmD4KvB321/w1Z4XQws/llNLEFEnwk3NrKB+Vi4+pBWAJf0G0JSw+ewFK9NO0Q3SF6e5jtQ== X-YMail-OSG: pk8bGwQVM1nBGaq0IwKzOr3EPf8M8knnb.jqaDVdK7wyOZyj3mr0EjzQDWW_OiQ 1X0OrNJ9wSStI_4JXaC2qCwTNNWThtJlTWPtyrU.IOFZ6T.8Fi0xoIfi4MnlV4n.zbvUkdgsiixP H8NCnBhOwJSOrcFFveajRFQlRCSH9yZWHHQwsMs_mLtqAhRJncm6KJVVjC2sUAaC4r1mrpHTzRl. PZDO6bltTzjePGUr2.ivnf.R0xPQXALwwlxh1dTvPhdDtjTQZnxjtuWnftAaGOi6xuO2fpMjizQw A9L0qziUejKtY8dDh_qqqMzKwO_ZiwBR.ETBAb7ryY740.n9itBqeE6HXCS3T0n4bSnc9R0Z88Zm r7N84HoRIbG8AxR9g63iMLpB9RZ1pdfT_EiJ0jpwH0Atqfov3lcJWGSn0mlJmaedUq6JATvIRC3D iKoyX2W1Fa9KEbEscNSKZ9u8YvjkqLDC2QskPOrsQqSteguNaiDtNosNrmMHCXp7pUKPWRfpDToI im.odaolpawBwuKx.nUlj6oABx9EsHYXIpBaVL6N2waAECzPtWnyiLeNLN80Rdxu83WOj4RenO1v J62TAJT0_LDJY31mN_Mq4K.sgoEsvN.P7VwORjXQeJKFcVQSdLL8vnn_i79uJ41dYSnTe27mgo3s B2g66Z3z0PlemMlfhTeNn1VgkZtXjfY3aWSstU6IY8n5hYP8YQJanne5Gd6u8KPD27PAiwFtZUtd moXNNLBFrd4qwMfLhq4.LCwv682GJol.FNm_rrqMc6wm4KRZzUMuJV1Q9XwgvADHk9L0bPqLS6Ap zRFeFOLLCMO92dGnSuedeSfAyextA.Br4lQRzVP9Gb Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.bf2.yahoo.com with HTTP; Tue, 8 Sep 2020 08:08:09 +0000 Original-Received: by smtp406.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 3926a4ece63b7d24f452ff5213591c92; Tue, 08 Sep 2020 08:08:08 +0000 (UTC) Content-Disposition: inline In-Reply-To: <865z8p2qay.fsf@gmail.com> X-Mailer: WebService/1.1.16565 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Apache-HttpAsyncClient/4.1.4 (Java/11.0.7) Received-SPF: pass client-ip=74.6.133.125; envelope-from=spacibba@aol.com; helo=sonic313-15.consmr.mail.bf2.yahoo.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 04:08:09 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:254706 Archived-At: 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.