unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Gabriel <gabriel376@hotmail.com>
To: emacs-devel@gnu.org
Subject: The tab-line "All" group
Date: Mon, 21 Nov 2022 06:42:20 -0300	[thread overview]
Message-ID: <SJ0PR06MB8609724F72C31D71F3CCE5648B0A9@SJ0PR06MB8609.namprd06.prod.outlook.com> (raw)

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

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.  If an "All" group is really useful, we can properly
implement it, i.e., to have a group that *actually* contains all tabs.

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.

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



             reply	other threads:[~2022-11-21  9:42 UTC|newest]

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

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=SJ0PR06MB8609724F72C31D71F3CCE5648B0A9@SJ0PR06MB8609.namprd06.prod.outlook.com \
    --to=gabriel376@hotmail.com \
    --cc=emacs-devel@gnu.org \
    /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).