bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69305: outline-minor-mode for tabulated-list-mode


From: Juri Linkov
Subject: bug#69305: outline-minor-mode for tabulated-list-mode
Date: Tue, 27 Feb 2024 19:40:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> >> >> >> Sorry, I don't understand what is unclear here:
>> >> >> >>
>> >> >> >>   If the value is a list, each list element corresponds to one 
>> >> >> >> group, and
>> >> >> >>   should have the form @w{@code{(@var{group-name} @var{entries})}}, 
>> >> >> >> where
>> >> >> >>   @var{group-name} is a string inserted before all group entries, 
>> >> >> >> and
>> >> >> >>   @var{entries} have the same format as 
>> >> >> >> @code{tabulated-list-entries}
>> >> >> >>   (see above).
>> >> >> >>
>> >> >> >> Basically this says that the format is (group-name entries) where
>> >> >> >> entries are described in tabulated-list-entries as having the format
>> >> >> >> (id contents).  There is no need to duplicate the description of 
>> >> >> >> entries.
>> >> >> >
>> >> >> > Maybe I'm missing something here.  To put it more concretely, can you
>> >> >> > show a value of tabulated-list-groups that will cause the buffers in
>> >> >> > buffer list grouped by major mode using the above form?
>> >> >>
>> >> >> Data structure for `tabulated-list-groups' is a list of elements,
>> >> >> each element should of the form
>> >> >>
>> >> >>   (GROUP-NAME (ID . CONTENTS) (ID . CONTENTS) ...)
>> >> >>
>> >> >> where GROUP-NAME is the name of the group, ID is a Lisp object that
>> >> >> identifies the entry and CONTENTS is a vector with the same number of
>> >> >> elements as `tabulated-list-format'.  When buffers grouped by major 
>> >> >> mode:
>> >> >>
>> >> >>   (("* Lisp Interaction" (#<buffer *scratch*> ["." " " "*" 
>> >> >> #("*scratch*" 0 9 ...) "225" "Lisp Interaction" ""]) ...))
>> >> >
>> >> > This is the value that the user is supposed to supply for the
>> >> > defcustom?  That is, the user must specify all the buffers explicitly?
>> >> > What happens when there's one more buffer in some mode? does the user
>> >> > have then to modify the value of the defcustom?
>> >>
>> >> This describes the internal data structure, not a defcustom.
>> >
>> > Well, my question above, viz.:
>> >
>> >>> > Maybe I'm missing something here.  To put it more concretely, can you
>> >>> > show a value of tabulated-list-groups that will cause the buffers in
>> >>> > buffer list grouped by major mode using the above form?
>> >
>> > was about the value of this defcustom.  I hoped that by having such a
>> > value as part of this discussion, we will be able to clear any
>> > misunderstandings that could be getting in the way.
>>
>> But tabulated-list-groups is not a defcustom.
>> There are no defcustoms here.
>
> Buffer-menu-group-by _is_ a defcustom, and it is documented thusly:
>
>   +  "If non-nil, buffers are grouped by function.
>   +This function takes one argument: a list of entries in the same format
>   +as in `tabulated-list-entries', and should return a list in the format
>   +suitable for `tabulated-list-groups'.
>
> So you are inviting users to write functions that return values of a
> certain format, but the format's documentation IMO doesn't make it
> clear how to specify a grouping, and for its important part alludes to
> another variable (tabulated-list-entries), whose documentation is
> suitable for different kind of uses, not for grouping of entries.

The format 'tabulated-list-entries' is input.
The format 'tabulated-list-groups' is output.

> Since tabulated-list-groups is such an important part of the
> documentation of Buffer-menu-group-by, the doc string of
> tabulated-list-groups is in effect part of the doc string of
> Buffer-menu-group-by, and should IMO be worded as appropriate for user
> options.

The docstring of 'tabulated-list-groups' already
sufficiently documents the format:

  (defvar-local tabulated-list-groups nil
    "Groups displayed in the current Tabulated List buffer.
  This should be either a function, or a list.
  If a list, each element has the form (GROUP-NAME ENTRIES),
  where:

   - GROUP-NAME is a group name as a string, which is displayed
     at the top line of each group.

   - ENTRIES is a list described in `tabulated-list-entries'.

There is no need to duplicate the description of linked
'tabulated-list-entries'.  And here it's clear that the function
should add GROUP-NAME to groups from 'tabulated-list-entries'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]