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: Fri, 9 Apr 2021 14:12:21 +0300 Message-ID: References: <9c9af088-580f-9fb1-4d79-237a74ce605c@inventati.org> <874kgkxxs0.fsf@posteo.net> <3ec7e2e58a100426a22e@heytings.org> <871rblbzs7.fsf@mail.linkov.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="32959"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0.6 (2021-03-06) Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 09 13:16:56 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 1lUp8C-0008R5-3Q for ged-emacs-devel@m.gmane-mx.org; Fri, 09 Apr 2021 13:16:56 +0200 Original-Received: from localhost ([::1]:44556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUp8B-0003EC-3o for ged-emacs-devel@m.gmane-mx.org; Fri, 09 Apr 2021 07:16:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUp6r-0002Ns-NM for emacs-devel@gnu.org; Fri, 09 Apr 2021 07:15:33 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:39371) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUp6p-00043U-Eb for emacs-devel@gnu.org; Fri, 09 Apr 2021 07:15:33 -0400 Original-Received: from localhost ([::ffff:41.202.241.27]) (AUTH: PLAIN securesender, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000001DF56.0000000060703750.00001838; Fri, 09 Apr 2021 04:15:27 -0700 Mail-Followup-To: Juri Linkov , emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: <871rblbzs7.fsf@mail.linkov.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:267703 Archived-At: * Juri Linkov [2021-04-07 23:39]: > > It maybe possible to improve tabulated-list-mode so that it may be > > used for selection of items. > > You meant to improve completing-read to support tabulated-list-mode? What I mean is: - to be able to offer either list of strings or list of lists with various data - data is automatically formatted to fit into tabulated-list-mode - user may select one or more entries in tabulated-list-mode by browsing or filtering - user may press RET or something else to select, the tabulated-list-mode buffer is burried and selection taken. Now if that or similar flow can be glued to completing-read even better, it would be great. I find default completing-read in many cases superior to various completion packages, but this may be due to my personalized habits of using TAB, using "-" to complete shorter or using wildcard "*". But those completions are interferring with the work. They are focusing on minibuffer or other window where user is expected to do exactly that what program wants, usually user cannot exit from there and review other window, or do some other selection. The concept I have explained I already use in a limited manner and it offers me browsing from one set of data to other set of data. But I do not have possibility (yet) to construct tabulated-list-frame and just click to get the result. Small example on what I would need: (defun complete-by-tab () (let ((tabulated-list-format [("ID" 10 t) ("Name" 30 t) ("Group" 30 t)]) (tabulated-list-entries '((1 ["1" "Joe" "Friends"]) (2 ["2" "Jane" "Love"]) (3 ["3" "Jimmy" "Job"]))) (buffer (generate-new-buffer "Tabulated List Mode"))) (switch-to-buffer buffer) (tabulated-list-mode) (setq tabulated-list-padding 1) (tab-select-local-map) (tabulated-list-init-header) (tabulated-list-print))) (defvar-local rcd-tabulated-marked-items nil "Collects IDs for tabulated list modes") (defun rcd-tabulated-mark-id () "To mark entries" (interactive) (let ((id (tabulated-list-get-id))) (when id (tabulated-list-put-tag "⇉" t) (cl-pushnew id rcd-tabulated-marked-items)))) ;; (message "Marked ID %s (%s)" id rcd-tabulated-marked-items)))) (defun tab-select-local-map () (interactive) (let ((map (make-sparse-keymap))) (set-keymap-parent map tabulated-list-mode-map) (define-key map "m" 'rcd-tabulated-mark-id) (define-key map (kbd "RET") '(lambda () (interactive) (if rcd-tabulated-marked-items (setq my-selection rcd-tabulated-marked-items) (setq my-selection (list (tabulated-list-get-id)))) (quit-window))) (use-local-map map))) (complete-by-tab) Now after this I can mark entries or select one entry, that is fine, and I get result: my-selection ⇒ (3 2 1) Not bad... But I would like to find the solution to return the result back to program execution. As this below does not work how I would like it: (progn (complete-by-tab) (message "%s" my-selection)) Result is that I cannot get the selection. Maybe if I use with-temp-buffer and invoke tabulated-list-mode? I would like to know how to wait without blocking for complete-by-tab until it finishes it execution that I can read `my-selection'. tabulated-list-mode is great tool for menu and submenu browsing, or tree browsing. But it is not visible tree on the page, I have to create new frames to browse subtres, which is not bad for now. -- 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/