emacs-devel
[Top][All Lists]
Advanced

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

The tab-line "All" group


From: Gabriel
Subject: The tab-line "All" group
Date: 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).

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 via email to

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