all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: tabulated-list-mode needs incremental search option
Date: Sun, 15 Nov 2020 12:15:13 +0300	[thread overview]
Message-ID: <X7DxoZs76Y5H9Kfa@protected.rcdrun.com> (raw)
In-Reply-To: <X6pPfwlPLiq6WNMr@protected.rcdrun.com>

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 "<RET>") '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 <bugs@gnu.support> [2020-11-10 13:37]:
> * Chong Yidong <cyd@stupidchicken.com> [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



      parent reply	other threads:[~2020-11-15  9:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <courier.000000005F931B0B.00007C35@static.rcdrun.com>
     [not found] ` <87361liqpt.fsf@gmail.com>
     [not found]   ` <X6Zpq8t4bi+rkrQ3@protected.rcdrun.com>
     [not found]     ` <87v9edu11u.fsf@stupidchicken.com>
2020-11-10  8:29       ` tabulated-list-mode needs incremental search option Jean Louis
2020-11-10 13:17         ` Stefan Monnier
2020-11-10 19:00           ` Jean Louis
2020-11-11 19:09             ` Juri Linkov
2020-11-11 20:50               ` Drew Adams
2020-11-11 21:20               ` Jean Louis
2020-11-12  7:18                 ` Juri Linkov
2020-11-12  7:57                   ` Jean Louis
2020-11-11 21:38               ` Jean Louis
2020-11-15  9:15         ` Jean Louis [this message]

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

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

  git send-email \
    --in-reply-to=X7DxoZs76Y5H9Kfa@protected.rcdrun.com \
    --to=bugs@gnu.support \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.