emacs-devel
[Top][All Lists]
Advanced

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

Re: Tabs


From: Juri Linkov
Subject: Re: Tabs
Date: Wed, 25 Sep 2019 23:15:32 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> The current implementation is already flexible enough, so for example,
>> what you asked for *info* buffers, is possible to do with the current
>> implementation with just a few lines:
>>
>>   (advice-add 'tab-line-tabs :around
>>               (lambda (orig-fun &optional window)
>>                 (if (derived-mode-p 'Info-mode)
>>                     (mapcan (lambda (b)
>>                               (with-current-buffer b
>>                                 (when (derived-mode-p 'Info-mode)
>>                                   (list b))))
>>                             (buffer-list))
>>                   (funcall orig-fun window))))
>
> This seems exactly what I imagined - sounds very promising.

Now configuration is even simpler:

  (add-hook 'Info-mode-hook
            (lambda ()
              (setq-local tab-line-tabs-function
                          (lambda ()
                            (mapcan
                             (lambda (b)
                               (when (with-current-buffer b (derived-mode-p 
'Info-mode))
                                 (list b)))
                             (buffer-list))))))

And you can even use the tab-bar as well for the same purpose
(if you don't need to switch window configurations):

  (add-hook 'Info-mode-hook
            (lambda ()
              (setq-local tab-bar-tabs-function
                          (lambda ()
                            (mapcan
                             (lambda (b)
                               (when (with-current-buffer b (derived-mode-p 
'Info-mode))
                                 (list `(,(if (eq b (current-buffer)) 
'current-tab 'tab)
                                         (name . ,(buffer-name b))
                                         (binding . (lambda () (interactive) 
(switch-to-buffer ,b)))
                                         (close-binding . (lambda () 
(interactive) (kill-buffer ,b) (force-mode-line-update)))))))
                             (buffer-list))))))

> Looking forward for it to appear in master.

After thorough testing and improving customization the work on the
branch is finished, and it is mostly ready for merge, but writing
documentation is the most time-consuming process.  I hope to finish
writing documentation by the weekend.



reply via email to

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