unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44078: 26.3; `tabulated-list-mode': Use it in any mode and for part of a buffer
@ 2020-10-19 16:03 Drew Adams
  2020-10-20 11:35 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2020-10-19 16:03 UTC (permalink / raw)
  To: 44078

Feature request:

I'd like to see `tabulated-list-mode' be usable for only part of a
buffer.  How?  Dunno.  Text property maybe, analogous to property
`keymap'?

One of its greatest weaknesses is that it's (only) a major mode.  It's
buffer-wide, which means you can't do anything else in the buffer.  You
can't use `tabulated-list-mode' for just some table(s) (tabulated info)
within a buffer.  This greatly limits its usefulness, IMO.

In the beginning, IIRC, there was only the major mode `outline-mode'.
Later we added `outline-minor-mode'.  That at least took care of the
problem of not being able to use it with another major mode.

But for `tabulated-list-mode' I think we need more than just to add a
minor-mode version.  We really need a way to confine its effect to a
part of a buffer.

In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.18362
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#44078: 26.3; `tabulated-list-mode': Use it in any mode and for part of a buffer
  2020-10-19 16:03 bug#44078: 26.3; `tabulated-list-mode': Use it in any mode and for part of a buffer Drew Adams
@ 2020-10-20 11:35 ` Lars Ingebrigtsen
  2020-10-20 16:20   ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-20 11:35 UTC (permalink / raw)
  To: Drew Adams; +Cc: 44078

Drew Adams <drew.adams@oracle.com> writes:

> But for `tabulated-list-mode' I think we need more than just to add a
> minor-mode version.  We really need a way to confine its effect to a
> part of a buffer.

Whenever I've done some work on tabulated-list-mode, I've been kinda
frustrated by its design.  You'd ideally just be able to have a
functional interface where you just call a function with all the data
(and some commands to apply to the data), and then everything would
work.  But instead it's a strange mixture of functional, buffer-local
data and updating functions.

A side effect of this is that the table isn't an "object" you can do
operations on -- there can only be one table per buffer, and it wants to
control the entire buffer.

So I'd welcome a more functional rewrite of tabulated-list-mode that
would constrain all actions to the area of the buffer where the table
is, and leave the rest of the buffer alone.  And stash the table data in
the table instead of using the buffer-local variables.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#44078: 26.3; `tabulated-list-mode': Use it in any mode and for part of a buffer
  2020-10-20 11:35 ` Lars Ingebrigtsen
@ 2020-10-20 16:20   ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2020-10-20 16:20 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 44078

> > But for `tabulated-list-mode' I think we need more than just to add a
> > minor-mode version.  We really need a way to confine its effect to a
> > part of a buffer.
> 
> Whenever I've done some work on tabulated-list-mode, I've been kinda
> frustrated by its design.  You'd ideally just be able to have a
> functional interface where you just call a function with all the data
> (and some commands to apply to the data), and then everything would
> work.  But instead it's a strange mixture of functional, buffer-local
> data and updating functions.
> 
> A side effect of this is that the table isn't an "object" you can do
> operations on -- there can only be one table per buffer, and it wants to
> control the entire buffer.
> 
> So I'd welcome a more functional rewrite of tabulated-list-mode that
> would constrain all actions to the area of the buffer where the table
> is, and leave the rest of the buffer alone.  And stash the table data in
> the table instead of using the buffer-local variables.

I agree with all that you say.  And this is a great
summary of my feelings about the failings of t-m-mode:

  there can only be one table per buffer,
  and it wants to control the entire buffer

I don't expect this enhancement request to get traction
anytime soon.  And in fact I think that ultimately this
is related to the real need for some kind of reasonable,
robust, multiple-major-modes feature.

That might not be the best name, and there are multiple
ways to envision such things.  But wrt this request,
I'm thinking of an ability to, in the same buffer, have
tables that are governed by something like t-m-mode, but
without impacting the buffer mode in general or at least
other parts of the buffer.

The key-bindings part could likely be dealt with using
a `keymap' text property.  But t-m-mode is a major mode
so far, and there are its local variables to be dealt
with (and a mode hook, and maybe other buffer-related 
stuff).

Variables with values specific to a given span of text,
i.e., realized via text properties, might be a way to
deal with some of this.  Dunno, and dunno how that
might be realized.

Just thinking out loud.  I'm sure that others, who've
spent a lot of time trying to think about multiple
major modes, have a much better view of the obstacles
and possibilities in this regard.

It just seems to me that making t-m-mode a major mode
is a mistake.  You can't even add any additional text
to the buffer, outside the table - not even a heading.
It just kind of takes over a buffer, and that's quite
limiting.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-20 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 16:03 bug#44078: 26.3; `tabulated-list-mode': Use it in any mode and for part of a buffer Drew Adams
2020-10-20 11:35 ` Lars Ingebrigtsen
2020-10-20 16:20   ` Drew Adams

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).