From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.devel Subject: Re: Stepping Back: A Wealth Of Completion systems Re: [ELPA] New package: vertico Date: Wed, 7 Apr 2021 22:47:57 +0300 Message-ID: References: <9c9af088-580f-9fb1-4d79-237a74ce605c@inventati.org> <874kgkxxs0.fsf@posteo.net> <3ec7e2e58a100426a22e@heytings.org> <877dleb2px.fsf@posteo.net> <87blaq5amw.fsf@posteo.net> <87o8eplxgt.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33230"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0.6 (2021-03-06) Cc: Daniel Mendler , emacs-devel@gnu.org To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 07 21:52:33 2021 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 1lUEE4-0008YF-Iz for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Apr 2021 21:52:32 +0200 Original-Received: from localhost ([::1]:58032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUEE3-0001z8-LJ for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Apr 2021 15:52:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUECI-0008U5-Vy for emacs-devel@gnu.org; Wed, 07 Apr 2021 15:50:43 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:41141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUECE-0002HI-Re for emacs-devel@gnu.org; Wed, 07 Apr 2021 15:50:42 -0400 Original-Received: from localhost ([::ffff:41.210.159.189]) (AUTH: PLAIN securesender, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000001DF49.00000000606E0D08.000002C8; Wed, 07 Apr 2021 12:50:30 -0700 Mail-Followup-To: Philip Kaludercic , Daniel Mendler , emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: <87o8eplxgt.fsf@posteo.net> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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:267567 Archived-At: * Philip Kaludercic [2021-04-07 22:14]: > Daniel Mendler writes: > > > On 4/7/21 6:20 PM, Philip Kaludercic wrote: > >> Well that is because imenu presents the options in the minibuffer, and > >> you have to go through the menu step-by-step. What I'm talking about is > >> a direct hierarchical visualisation, that should be navigable with the > >> intuitiveness of org-mode. > > > > This is a bit vague. If we have a tree structure one can have some > > tree-like visualization (like the sidebar tree browsers) or have an > > outline like in org-mode. But how would you actually navigate quickly? > > Using Avy-like keys? What if the structure does not fit on the screen > > easily, what if there are cycles, ...? > > I'm still thinking about all of this, and have to find the time to > implement a prototype. It might make sense to have a similar approach to > completing-read, where a variable like completing-read-function can > change everything. > > A tree-like visualisation would probably make more sense, as long as it > can be manipulated using the keyboard. I mentioned org-mode thinking of > the org-cycle command, and how it allows you to hide and show > subtrees. When selecting items in tabulated-list-mode, all of them have the ID, but some IDs have its type of being a Set or subtree. When subtree is choosen a new frame appears with its nodes. Similarly, completing-read could even now browse trees, it is matter of recognizing which item belong to a tree to immediately offer another completing-read with the nodes of the subtree. Subtrees cannot be selected, but those nodes or candidates which are not subtrees they can be selected. I am using strings with IDs like "Selection candidate [123]" and that is how I extract the ID of the item, then I can test for it if it is a subtree or not and offer new completing read on that. (defun string-cut-right-square-bracket-reference (s) "Returns the reference within square brackets on the end of S." (let* ((space (string-match " " (reverse s)))) (if space (let* ((id (substring (reverse s) 0 space))) (if (and (string-match "\\[" id) (string-match "\\]" id)) (replace-regexp-in-string "\\[\\\|\\]" "" (reverse id)) nil)) nil))) (string-cut-right-square-bracket-reference "Selection candidate [123]") → "123" (setq set '(10 20)) (setq collection-data '(("Candidate A" 10) ("Candidate B" 11) ("Candidate C" 20) ("Candidate D" 12) ("Candidate E" 13) ("Candidate D" 14))) (setq collection-verify collection-data) (setq collection nil) (while collection-data (let ((item (pop collection-data))) (push (format "%s [%s]" (car item) (cadr item)) collection))) (completing-read "Choose item: " collection) → "Candidate A [10]" Concept is here: (defun completing-read-tree (prompt collection) (while (member (string-to-number (string-cut-right-square-bracket-reference (completing-read "Choose: " collection))) set) (completing-read-tree prompt collection))) ;; at this point `collection' ;; would be replaced ;; with collection that ;; belongs to ;; particular set and ;; browsing trees with ;; completing read goes ;; deeper and deeper. A ;; key would be ;; required to go back. (completing-read-tree "Choose: " collection) -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns Sign an open letter in support of Richard M. Stallman https://rms-support-letter.github.io/