From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Tabs Date: Sun, 27 Oct 2019 01:40:41 +0300 Organization: LINKOV.NET Message-ID: <87ftjfruza.fsf@mail.linkov.net> References: <87a7bpysm8.fsf@mail.linkov.net> <875zlnu9ds.fsf@web.de> <87blvdxpr0.fsf@mail.linkov.net> <878sqhtbm3.fsf@web.de> <87v9tgnndn.fsf@mail.linkov.net> <87h84npa5e.fsf@web.de> <87imp2vns4.fsf@mail.linkov.net> <87a7aeth9c.fsf@web.de> <87blurnj4z.fsf@web.de> <87lftta63c.fsf@mail.linkov.net> <87d0f4n9l3.fsf@web.de> <87sgo0z5pj.fsf@mail.linkov.net> <87lftp3s8u.fsf@web.de> <871rvgftik.fsf@mail.linkov.net> <87o8yijcj2.fsf@web.de> <87wod0s60h.fsf@mail.linkov.net> <87eez1843b.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="971"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 27 00:42:36 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iOUlX-0018JE-Ha for ged-emacs-devel@m.gmane.org; Sun, 27 Oct 2019 00:42:35 +0200 Original-Received: from localhost ([::1]:43306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOUlV-0003mS-RS for ged-emacs-devel@m.gmane.org; Sat, 26 Oct 2019 18:42:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38633) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOUlM-0003Zu-0h for emacs-devel@gnu.org; Sat, 26 Oct 2019 18:42:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iOUlK-0004zF-ON for emacs-devel@gnu.org; Sat, 26 Oct 2019 18:42:23 -0400 Original-Received: from bisque.elm.relay.mailchannels.net ([23.83.212.18]:21283) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iOUlJ-0004xj-Ui for emacs-devel@gnu.org; Sat, 26 Oct 2019 18:42:22 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 9F5CF1A0A57; Sat, 26 Oct 2019 22:42:19 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a97.g.dreamhost.com (100-96-14-244.trex.outbound.svc.cluster.local [100.96.14.244]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 360CF1A0190; Sat, 26 Oct 2019 22:42:19 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a97.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Sat, 26 Oct 2019 22:42:19 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Robust-Obese: 057882cd3ee93796_1572129739451_2143205778 X-MC-Loop-Signature: 1572129739451:3866602968 X-MC-Ingress-Time: 1572129739450 Original-Received: from pdx1-sub0-mail-a97.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a97.g.dreamhost.com (Postfix) with ESMTP id 551257FF7C; Sat, 26 Oct 2019 15:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=zkLoIuVfJxCRYBPfXhuVdcw+swI=; b= y1SIo1KJbWa5cFOvydz9kucWUQk6d+QNRY1Lk8lBP4GH8MT4cFDwTk5ATdRw4F1R glHKo2NK7BAs8qf3OEY1IvzbFgrYPZXAGB1xfN/qx0TKmfr4D8HULty7KW2z/NGG Rv1gwj1cy9DJIID/oZPqH19BalZ+xtWMpfxGdDaAqOs= Original-Received: from mail.jurta.org (m91-129-98-153.cust.tele2.ee [91.129.98.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a97.g.dreamhost.com (Postfix) with ESMTPSA id 0DB957FF70; Sat, 26 Oct 2019 15:42:14 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a97 In-Reply-To: <87eez1843b.fsf@web.de> (Michael Heerdegen's message of "Fri, 25 Oct 2019 13:19:36 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 23.83.212.18 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:241487 Archived-At: > I've now just found out that what I want is to use a tab-line, like this: > > #+begin_src emacs-lisp > (require 'tab-line) > (setq-default tab-line-format nil) > (setq-default tab-line-close-tab-action #'kill-buffer) > > (setq-default > tab-line-tabs-function > (defun my-tab-line-get-mode-tabs () > (cl-sort > (let ((mode major-mode)) > (delq nil > (mapcar > (lambda (b) > (and (with-current-buffer b > (derived-mode-p mode)) > (not (string-match-p (rx bos " ") > (buffer-name b))) > b)) > (buffer-list)))) > #'string< :key #'buffer-name))) > > (defun my-enable-tab-line () > (setq-local tab-line-format '(:eval (tab-line-format)))) > > (dolist (hook '(Info-mode-hook eww-mode-hook)) > (add-hook hook #'my-enable-tab-line)) > #+end_src > [...] > I see that you did not have my use case in mind when I e.g. try > `tab-line-switch-to-next-tab': it switches to buffers that are not > displayed in the tab-line, and the tab-line just vanishes. > > Maybe there could be different tab-bar/tab-line modes for the different > use cases, or something like that, haven't thought about it. Thanks for posting the use case with real needs, so now it's clear how to make tab-line customizable. Now you can replace all code above with just 3 lines: (setq tab-line-tabs-function #'tab-line-tabs-mode-buffers) (dolist (hook '(Info-mode-hook eww-mode-hook)) (add-hook hook #'tab-line-mode)) This is because now tab-line-tabs-function is customizable to the function that populates the tab-line with buffers having the same mode. Also there is separate global-tab-line-mode that affects all buffers and buffer-local tab-line-mode. tab-line-switch-to-next-tab works as well in your case now.