From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Dirk-Jan C. Binnema" Newsgroups: gmane.emacs.devel Subject: Re: Extend tabulated-list-mode to support marks Date: Sat, 25 Jul 2020 16:46:32 +0300 Message-ID: <87mu3nk8qv.fsf@gmail.com> References: <20200724005105.11f85d5f@pineapple> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8124"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.5.5; emacs 28.0.50 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 25 15:47:23 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 1jzKWI-0001zk-FN for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Jul 2020 15:47:22 +0200 Original-Received: from localhost ([::1]:36118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jzKWH-0003Ij-Hx for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Jul 2020 09:47:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jzKVa-0002rz-B4 for emacs-devel@gnu.org; Sat, 25 Jul 2020 09:46:38 -0400 Original-Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:43311) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jzKVY-0005eg-Gr for emacs-devel@gnu.org; Sat, 25 Jul 2020 09:46:38 -0400 Original-Received: by mail-lj1-x229.google.com with SMTP id f5so12701571ljj.10 for ; Sat, 25 Jul 2020 06:46:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:in-reply-to:date:message-id :mime-version:content-transfer-encoding; bh=GiTe5kbs6kbMaCXQvNsZPWgvKwFEtsDEJwdHAhpErlI=; b=B3l9oCZuWMtsbDfROadrR36KLkc0syAq2O4Xh1Zpf9xBO/S4wkWjXpYcALmkg/xWJ5 DnsL8Wn9sHXBYmBQ/OqBkegke1s72V1SMpEN2W2MUOqXkpCfUzdiFbLdKb3B27Tmk9ML HNCmWFbgrlPU1amT886QJidq6H+KBQZ+ypwFZ/pmjgM9KZO6ZGkaeBpm0+OHqqixOEaV DBsG1YxK3xRYLUKTNhXXbouNTCqBgpjZnBc06584nhOGSNHkqJ4QjKGFW65plQ3vZd3f opsvNX9nS8fghPUOf5BQ4dk9DqdN2aQtv1qC9s0tYkw15LTcbmPRthuBeji82ACnHELs TVQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject :in-reply-to:date:message-id:mime-version:content-transfer-encoding; bh=GiTe5kbs6kbMaCXQvNsZPWgvKwFEtsDEJwdHAhpErlI=; b=SLzDBYWg8mnrWXTA7PJXbdPnU2t4GDHZlmiU0qo/nr4wp7QkfmYEndpVnGciwBW57+ qurdg6el7CUX3Wkr9Tlpzqbf6C+IDRUkzahislw4ZYsJ86fPaYrn0p4GEapzM/IT5cAA jC1a0FAV0HKDViEI3WuBVVNOHU19BwzzkeIzRtuuY4sRLSap1TUD7x7iXBjoXWHGpCtW aviRQyzuTp0szDd6msUS6Ka2rA/Zki6db3Rl6yPJ1Y+XJmh6gEqeSurgmC2PPTLo/MDw D7ouzIy9ZqFjhlrmdC2yuMK7NJYT9dBJgDSzYDX9N1lZZaCsntCtCeii8MUYrJeCbGpr qXXw== X-Gm-Message-State: AOAM530nIEdTQO3dZ40VrtzVBNQgcab0omX1ckcyiyTP9qrqIVomsnin PxeDtVpimWbBf4HnMUO/zWEq7gxN X-Google-Smtp-Source: ABdhPJx5JIjifsVfqVUjydaH8uB9hWDp8umQAnyShtQeeC1HSl3LjusEks+sfc3FZLNE49Ytn1ttcQ== X-Received: by 2002:a2e:2e07:: with SMTP id u7mr5946941lju.195.1595684793926; Sat, 25 Jul 2020 06:46:33 -0700 (PDT) Original-Received: from evergrey (85-76-144-235-nat.elisa-mobile.fi. [85.76.144.235]) by smtp.gmail.com with ESMTPSA id g11sm1116630lfc.46.2020.07.25.06.46.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Jul 2020 06:46:33 -0700 (PDT) In-reply-to: Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=djcb.bulk@gmail.com; helo=mail-lj1-x229.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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:253212 Archived-At: On Friday Jul 24 2020, Yuri Khan wrote: > On Fri, 24 Jul 2020 at 22:05, Stefan Monnier w= rote: > >> > 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 =E2=80=98tabulated-list-mode= =E2=80=99 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 =E2=80=9Cunmark = all=E2=80=9D > key for =E2=80=9Cmark upgradable packages=E2=80=9D. I think they would be= nefit 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 =E2=80=98tabulated-list-mode=E2=80=99 which marks it = supports. > E.g.: > > * Set =E2=80=98tabulated-list-delete-function=E2=80=99 to a non-nil funct= ion that will > delete the item at point or signal an error. Then the command bound to > =E2=80=98D=E2=80=99 will invoke that function and remove its visual repre= sentation > from the buffer; =E2=80=98d=E2=80=99 will mark the item at point for dele= tion; =E2=80=98x=E2=80=99 > will go through all the items marked for deletion and actually delete > and remove them; =E2=80=98u=E2=80=99 will unmark the item at point; and = =E2=80=98U=E2=80=99 will > unmark all items. > > * Set =E2=80=98tabulated-list-marks=E2=80=99 to a string of characters. I= f that string > contains =E2=80=98>=E2=80=99, =E2=80=98m=E2=80=99 will mark the item at p= oint with =E2=80=98>=E2=80=99. 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). =E2=80=98u=E2=80= =99 and =E2=80=98U=E2=80=99 > 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=E2=80=99s > 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