unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Juri Linkov <juri@linkov.net>
To: "R. Diez" <rdiezmail-emacs@yahoo.de>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: Help customising the behaviour of the new Tab Line mode
Date: Mon, 17 Aug 2020 03:33:36 +0300	[thread overview]
Message-ID: <878seeys27.fsf@mail.linkov.net> (raw)
In-Reply-To: <005b781b-a6e0-e1b8-bf2e-090c67de16ac@yahoo.de> (R. Diez's message of "Fri, 14 Aug 2020 15:34:29 +0200")

> For example, I tend to have source.h to the left and source.cpp to the
> right, so that I can quickly switch between them. I tend to keep all such
> .h & .cpp files in pairs on the tab bar.
> [...]
> Issue 1) The first thing I noticed is that 'compile' creates
> a window/pane/whatever for the compilation output, and the tab line at the
> top does not show the compilation buffert. In fact, if I call
> split-window-below, the tab line below only has the current buffer on
> it. However, I would like all Tab Lines to show all buffers (or at least
> all buffers visited in the whole frame). And I want all those buffers to
> have the same tab order (because my positional memory is useful, but
> limited). That would match the behaviour of the old tabbar.el package. How
> do I achieve that? Please remember that my Lisp is rather limited. I can
> tinker, but it won't be pretty. 8-)

Please try this code:

(defun tab-line-tabs-mode-sorted-buffers ()
  "Return a list of buffers sorted by file name and file extension."
  (seq-sort-by #'buffer-name
               (lambda (a b)
                 (cond
                  ((equal (file-name-sans-extension a) (file-name-sans-extension b))
                   (string> (file-name-extension a) (file-name-extension b)))
                  (t
                   (string< a b))))
               (seq-filter (lambda (b) (and (buffer-live-p b)
                                            (/= (aref (buffer-name b) 0) ?\s)))
                           (buffer-list))))

(setq tab-line-tabs-function 'tab-line-tabs-mode-sorted-buffers)

Does it sort tabs in the order that you prefer?

It keeps .h & .cpp files in pairs where source.h is to the left
and source.cpp to the right.



  parent reply	other threads:[~2020-08-17  0:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <005b781b-a6e0-e1b8-bf2e-090c67de16ac.ref@yahoo.de>
2020-08-14 13:34 ` Help customising the behaviour of the new Tab Line mode R. Diez
2020-08-14 14:26   ` Robert Pluim
2020-08-14 19:37     ` R. Diez
2020-08-15 10:09   ` Michael Heerdegen
2020-08-16  1:27     ` Juri Linkov
2020-08-17  0:33   ` Juri Linkov [this message]
2020-08-18  6:12     ` R. Diez
2020-08-19  1:28       ` Juri Linkov
2020-08-19  7:16         ` R. Diez
2020-08-20  0:31           ` Juri Linkov
2020-08-20  4:11           ` Stefan Monnier

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=878seeys27.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rdiezmail-emacs@yahoo.de \
    /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.
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).