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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 24 Feb 2024 20:13:08 +0200

> From: Juri Linkov <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 24 Feb 2024 19:43:25 +0200
> 
> >> 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?

> >> >> >> +(ert-deftest tabulated-list-groups ()
> >> >> >> +  (with-temp-buffer
> >> >> >> +    (tabulated-list-mode)
> >> >> >> +    (setq tabulated-list-groups
> >> >> >> +          (reverse
> >> >> >> +           (seq-group-by (lambda (b) (concat "* " (aref (cadr b) 3)))
> >> >> >> +                         tabulated-list--test-entries)))
> >> >> >> +    (setq tabulated-list-format tabulated-list--test-format)
> >> >> >> +    (setq tabulated-list-padding 7)
> >> >> >> +    (tabulated-list-init-header)
> >> >> >> +    (tabulated-list-print)
> >> >> >
> >> >> > This seems to test only the function value of tabulated-list-groups?
> >> >> > What about the other form of the value?
> >> >>
> >> >> The other forms have no functional difference.
> >> >
> >> > Sorry, I don't follow.  Shouldn't we test the capability of specifying
> >> > grouping by the method other than by providing a function?
> >>
> >> Actually there are no other methods.
> >
> > The doc string says the "value can be either a list or a function".  I
> > see only one value here, so I'm asking what about a value of the other
> > form.  Or what am I missing here?
> 
> Another form is a function.  But there is no need to test this.
> It's just a copy from tabulated-list-entries that is unused.

I give up.