unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Dirk-Jan C. Binnema" <djcb.bulk@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Extend tabulated-list-mode to support marks
Date: Sat, 25 Jul 2020 16:46:32 +0300	[thread overview]
Message-ID: <87mu3nk8qv.fsf@gmail.com> (raw)
In-Reply-To: <CAP_d_8XeJRA2_1kF6pL9RwoysP5CAsO7NQA25rx8q6o4NAv5fg@mail.gmail.com>


On Friday Jul 24 2020, Yuri Khan wrote:

> On Fri, 24 Jul 2020 at 22:05, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
>> > and (2) if maybe tabulated-list-mode would benefit from a generic
>> > implementation of multiple marking, unmarking, marking-for-deletion,
>> > and command application.
>>
>> Maybe "for deletion" is too application-specific (some uses of
>> `tabulated-list-mode` can't "delete" or at least not conveniently enough
>> that it's a common use case), but a definite +1 for the rest.
>
> My point is that there are many instances of a generic scenario:
> Display a list of items; enable the user to perform operations on a
> single item at point or to mark multiple items and operate on them as
> a subset. Currently, each mode derived from ‘tabulated-list-mode’ has
> to reimplement marking, unmarking, mark preservation over refresh,
> iterating over marked items, and fallback to the item at point when no
> marks are set. One high-visible derived mode hijacks the “unmark all”
> key for “mark upgradable packages”. I think they would benefit from a
> common implementation and the unification of the UI stemming from
> that.
>
>
> One possibility would be for a derived mode to set some buffer-local
> variables to inform ‘tabulated-list-mode’ which marks it supports.
> E.g.:
>
> * Set ‘tabulated-list-delete-function’ to a non-nil function that will
> delete the item at point or signal an error. Then the command bound to
> ‘D’ will invoke that function and remove its visual representation
> from the buffer; ‘d’ will mark the item at point for deletion; ‘x’
> will go through all the items marked for deletion and actually delete
> and remove them; ‘u’ will unmark the item at point; and ‘U’ will
> unmark all items.
>
> * Set ‘tabulated-list-marks’ to a string of characters. If that string
> contains ‘>’, ‘m’ will mark the item at point with ‘>’. Other marks
> listed in the string can be set by the derived mode binding a key to a
> function that will call (tabulated-list-set-mark CHAR). ‘u’ and ‘U’
> will unmark the item at point or all items, respectively. A helper
> function, (tabulated-list-map CHAR FUNC), will execute FUNC on each
> item marked CHAR or on the item at point if no items are marked,
> optionally removing the item or unmarking it depending on FUNC’s
> return value; this can be invoked in any commands bound in the derived
> mode keymap.
>
> I might implement something if this general direction is deemed
> desirable. Details can be discussed.

Something like that would be most welcome; I'm using a custom
'dired-like' implementation for mu4e's header-view, and I need the
marking / unmarking, applying commands, adding/removing entries etc.; if
emacs were to gain some standard facility for that, that would really
help.

Some bonus items would be to allow for a tree-view, with
expand/collapse, and multi-line items.

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema                  Helsinki, Finland
e:djcb@djcbsoftware.nl           w:www.djcbsoftware.nl
gpg: 6987 9CED 1745 9375 0F14 DA98 11DD FEA9 DCC4 A036



  reply	other threads:[~2020-07-25 13:46 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 23:00 Add new functions to mark/unmark/delete all bookmarks Matthew White
2020-07-24  3:15 ` Drew Adams
2020-07-24  9:07   ` Matthew White
2020-07-24 15:07     ` Stefan Monnier
2020-07-24 15:18       ` Lars Ingebrigtsen
2020-07-24 17:03         ` Matthew White
2020-07-24 17:09           ` Stefan Monnier
2020-07-28 15:54             ` Matthew White
2020-07-28 16:14               ` Stefan Monnier
2020-07-28 16:36                 ` Matthew White
2020-07-28 18:06               ` Eli Zaretskii
2020-07-28 18:15                 ` Matthew White
2020-07-24 17:07         ` Drew Adams
2020-07-24 17:07       ` Drew Adams
2020-07-24 16:43     ` Drew Adams
2020-07-24  5:31 ` Yuri Khan
2020-07-24 15:05   ` Stefan Monnier
2020-07-24 16:56     ` Noam Postavsky
2020-07-24 19:00     ` Extend tabulated-list-mode to support marks Yuri Khan
2020-07-25 13:46       ` Dirk-Jan C. Binnema [this message]
2020-07-25 14:23       ` Stefan Monnier
2020-07-25 14:32         ` Yuri Khan
2020-07-26 12:43       ` Stefan Kangas
2020-07-24 17:07   ` Add new functions to mark/unmark/delete all bookmarks Drew Adams
2020-07-24 19:07 ` Karl Fogel
2020-07-25 10:46   ` Matthew White
2020-07-25 10:58     ` Eli Zaretskii
2020-07-25 15:33       ` Michael Albinus
2020-07-25 15:38         ` Eli Zaretskii
2020-07-25 15:56           ` Michael Albinus
2020-07-25 16:30             ` Eli Zaretskii
2020-07-25 16:33               ` Eli Zaretskii
2020-07-25 16:43                 ` Michael Albinus
2020-07-25 16:55                   ` Eli Zaretskii
2020-07-25 18:28                     ` Matthew White
2020-07-25 18:54                       ` Eli Zaretskii
2020-07-25 20:36     ` Karl Fogel
2020-07-25 21:14       ` Stefan Monnier
2020-07-25 22:40         ` Karl Fogel
2020-07-29 22:16     ` Karl Fogel
2020-07-31  2:58       ` Matthew White
2020-07-31  6:01         ` Karl Fogel
2020-08-02 22:13         ` Karl Fogel
2020-08-06 17:59           ` Matthew White
2020-08-07  1:10             ` Karl Fogel
2020-08-07  8:33               ` Matthew White
     [not found]               ` <jwveeojyxh1.fsf-monnier+emacs@gnu.org>
     [not found]                 ` <87a6z715do.fsf@red-bean.com>
2020-08-07 17:05                   ` Matthew White
2020-08-07 17:18                     ` Eli Zaretskii
2020-08-08  8:23                       ` Matthew White
2020-08-09 20:19                     ` Karl Fogel
2020-08-10  5:41                       ` Matthew White

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87mu3nk8qv.fsf@gmail.com \
    --to=djcb.bulk@gmail.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).