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: tabulated-list-mode needs incremental search option Date: Sun, 15 Nov 2020 12:15:13 +0300 Message-ID: References: <87361liqpt.fsf@gmail.com> <87v9edu11u.fsf@stupidchicken.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20493"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0 (3d08634) (2020-11-07) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 15 10:31:20 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 1keENS-0005Fn-EE for ged-emacs-devel@m.gmane-mx.org; Sun, 15 Nov 2020 10:31:18 +0100 Original-Received: from localhost ([::1]:46612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1keENR-0005m5-Gj for ged-emacs-devel@m.gmane-mx.org; Sun, 15 Nov 2020 04:31:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keELD-0004CU-5r for emacs-devel@gnu.org; Sun, 15 Nov 2020 04:28:59 -0500 Original-Received: from static.rcdrun.com ([95.85.24.50]:46615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keELB-0005Wj-5d for emacs-devel@gnu.org; Sun, 15 Nov 2020 04:28:58 -0500 Original-Received: from localhost ([::ffff:41.202.241.56]) (AUTH: PLAIN admin, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by static.rcdrun.com with ESMTPSA id 00000000002C0005.000000005FB0F4D7.00001873; Sun, 15 Nov 2020 09:28:54 +0000 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=95.85.24.50; envelope-from=bugs@gnu.support; helo=static.rcdrun.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/15 02:58:10 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] 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:259194 Archived-At: I actually wish to say for that feauture: real time filtering Please see emacs-tangents as I am discussing with Thien-Thi about it. https://lists.gnu.org/archive/html/emacs-tangents/2020-11/index.html Other question that you may know and I do not know it related to tabulated-list-mode. How could I get it to return the value of the tabulated list ID after closing the buffer, and when invoked from other program or buffer. Here is what I am trying to do, to make it as menu system where I can feed entries to be selected: (defun hyperscope-choice (entries &optional buffer-name) "This is meant to be te general choice UI with tabulated list mode" (interactive) (let* ((buffer-name (if buffer-name buffer-name "*HyperScope*"))) (pop-to-buffer buffer-name) (read-only-mode 0) (erase-buffer) (read-only-mode 1) (hyperscope-choice-mode) (hl-line-mode) (setq tabulated-list-entries entries) (tabulated-list-print t))) (defun hyperscope-choice-sql (sql &optional buffer-name) (interactive) (let* ((buffer-name (if buffer-name buffer-name "*HyperScope*")) (entries (hyperscope-sql-prepare-entries sql))) (hyperscope-choice entries buffer-name))) ;; (setq idb (hyperscope-choice-sql "SELECT contacts_id, get_full_contacts_name(contacts_id), '' FROM contacts WHERE contacts_lastname ~* 'louis'" "Choice")) ;; (hyperscope-sql-prepare-entries "SELECT contacts_id, get_full_contacts_name(contacts_id), '' FROM contacts WHERE contacts_lastname ~* 'louis'") (define-key hyperscope-choice-mode-map (kbd "") 'hyperscope-get-id) So this function here I do not know how to make it: - to kill the buffer and return the value back. I cannot kill the buffer this way, I have not yet discovered how. (defun hyperscope-get-id () "Returns the ID from hyperscope-choice-mode" (interactive) (let ((id (tabulated-list-get-id))) (when id (set-register 100 id) ;; character d, I am trying to enter value ;; in register, to obtain it later. (kill-this-buffer)))) But buffer does not get killed that I may return to previous program. * Jean Louis [2020-11-10 13:37]: > * Chong Yidong [2020-11-10 10:25]: > > Hi Jean Louis, > > > > > But now when you gave me references on how to filter the view then I > > > can make function for my particular case myself to enter one or more > > > words to filter by words. That is workaround, not real solution. > > > ... > > > In my opinion the above is enough for me. You said how / k filtering > > > is implemented, even I used it but I forgot it. You reminded me, so > > > now I can filter in similar way myself. > > > > > > If it happens that you decide to improve it, I have idea how you could > > > do it: simply concatenating all tabulated items with space between and > > > then using matching words on that list. > > > > Glad the interim solution can be done. > > > > I think the incremental typing functionality is best implemented as its > > own minor mode. It should not be tied to tabulated-list-mode. > > > > This could be modelled after Emacs' completion functions. In > > completion, you start typing and Emacs draws in information from the > > buffer to try and complete what you have in the minibuffer. In the new > > incremental processing mode, you start typing and Emacs alters the > > buffer to reflect what's in the minibuffer. Similar to completion, it > > would not be mode-specific, but different modes would be able to > > customize the effects in a way that makes sense for that mode. > > > > Could you file a feature request in the Emacs bug tracker, or send an > > email to emacs-devel to open a discussion? It's possible there's > > already related functionality that I'm not current aware of, e.g. in an > > external package. > > I will Cc: this email to emacs-devel. > > In general I am advising that every application with choices offers > among others the narrowing incremental search. > > Be it by invoking a key binding first or directly by simply > typing. Because there are various key bindings in almost every mode it > is better to start narrowing incremental seach when user press special > key like / or something. > > To come out of narrowed list one could press other key binding and see > the original list. > > In my program I am using (setq tabulated-list-entries entries) and it > is common in tabulated-list-mode. > > In my program I am using (setq tabulated-list-entries entries) and it > is common in tabulated-list-mode. > > So I guess it could be implemented as you said in a derived mode > invoked by programmer or program where: > > - user press some key to start a real-time narrowing incremental > search > > - program remembers the original `tabulated-list-entries' as > ORIGINAL-DATA > > - program can concatenate parts of each entry into strings (or maybe > use other method) during the incremental narrowing search > > - user starts typing and lines shown in tabulated-list-mode get > narrowed to selected lines > > - program obtains the ID numbers and displays only those ID numbers by > using (setq tabulated-list-entries NARROWED-DATA) and redisplays > > - use could press ENTER and narrowing incremental search stops at that > point, user is facing new tabulated list and can handle it in usual > manner. > > - user may press a key to go back to go to original > `tabulated-list-entries' and program does (setq > tabulated-list-entries ORIGINAL-DATA) and re-displays > > Jean