unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Gabriel <gabriel376@hotmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: The tab-line "All" group
Date: Fri, 12 Apr 2024 19:28:08 +0300	[thread overview]
Message-ID: <868r1jkodb.fsf@mail.linkov.net> (raw)
In-Reply-To: <SJ0PR06MB8609724F72C31D71F3CCE5648B0A9@SJ0PR06MB8609.namprd06.prod.outlook.com> (Gabriel's message of "Mon, 21 Nov 2022 06:42:20 -0300")

> The behavior of `tab-line-tabs-buffer-group-function' when returning
> nil, according to its docstring, is that the "buffer should be filtered
> out".  I found it not really elucidative, though.  The actual behavior
> is to display a group called "All" (currently, a hardcoded value) and
> don't display any tab (for the buffers that belongs to this group, i.e.,
> for cases when (funcall tab-line-tabs-buffer-group-function buffer)
> returns nil).
>
> What are the actual use-cases where the behavior of "filtering out" tabs
> (i.e. to don't display) for the "All" group is useful? (i.e., to hide
> tabs *only* in the "All" group when the user has explicitly enabled the
> tab-line mode to actually see tabs).

Sorry for the delay.  Some string is needed to display to not leave
the tab-line completely empty.

> Personally, I find it somewhat confusing, especially because the name
> "All" might led the user to think that this group contains all tabs,
> which is not true.  The name "Others"/"Rest"/etc would make more sense
> in this context.  If I had to choose, I would demand
> `tab-line-tabs-buffer-group-function' to always return a valid (non-nil)
> group name.

You are right, the "All" group is too confusing.  A proper name would be
"No group" or "Ungrouped".  "No group" is shorter, so let's use it.

> If an "All" group is really useful, we can properly
> implement it, i.e., to have a group that *actually* contains all tabs.

No need to implement an "All" group explicitly since a customized
tab-line-tabs-buffer-group-function can return the string "All"
for all ungrouped buffers.

> At last, when `tab-line-tabs-buffer-group-function' returns an empty
> string, it adds the opposite (undocumented and unintended, I guess)
> "feature": to display tabs but not the group name.  The tabs are
> actually added to a group named "", but the tab name is not displayed,
> since it's an empty string.  Not sure if this info is useful or if we
> need to change something here, but I thought it would be nice to share.

Thanks for sharing.  Maybe someone might need to show no group name
for some "default group".

> Here is a simple snippet to play with tab-line groups:
>
> #+begin_src emacs-lisp
> (progn
>   (defvar my-tab-line-group-default-value nil)
>
>   (defun my-tab-line-group-function (buffer)
>     "Group tab-line tabs by project."
>     (with-current-buffer buffer
>       (if-let ((project (project-current)))
>           (project-root project)
>         my-tab-line-group-default-value)))
>
>   (setopt tab-line-tabs-function 'tab-line-tabs-buffer-groups
>           tab-line-tabs-buffer-group-function #'my-tab-line-group-function)
>
>   (global-tab-line-mode 1))
> #+end_src

Thanks for suggesting a group by project name.  This will be added now
as a new option to 'tab-line-tabs-buffer-group-function'.

PS: maybe also will add a new option 'prev-buffers'
to 'tab-line-tabs-buffer-group-sort-function'
to sort buffers by the fixed order of their
appearance in the window using information
from window prev/next buffers.



      reply	other threads:[~2024-04-12 16:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21  9:42 The tab-line "All" group Gabriel
2024-04-12 16:28 ` Juri Linkov [this message]

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=868r1jkodb.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.org \
    --cc=gabriel376@hotmail.com \
    /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).