tornar `display-buffer` buffer aberto em nova aba
A display-bufferfunção parece ser muito usada no Emacs. Possui várias opções para determinar onde abrir um novo buffer (uma nova janela, um novo quadro, uma janela existente, etc).
O Emacs introduziu um conceito de guias em 27.1. No entanto, não parece ser uma maneira fácil de saber se display-buffervocê deseja que novos buffers sejam abertos em uma guia, em vez de apenas uma nova janela.
Existe alguma maneira de configurar display-bufferpara abrir todos os buffers em uma guia nova (ou existente?)?
A solução do NickD sugere o uso de uma função como display-buffer-in-tab.
Consegui fazer isso funcionar configurando display-buffer-base-actionda seguinte forma:
(setq display-buffer-base-action '(display-buffer-in-tab))
No entanto, isso não parece funcionar bem com funções como helpe magit-status. Eles tendem a abrir muitas guias sempre que são executados.
Configurações mais específicas podem ser necessárias por comando ou por novo buffer.
Respostas
Existe display-buffer-in-new-tab. Sua string doc diz:
display-buffer-in-new-tab is a compiled Lisp function in ‘tab-bar.el’.
(display-buffer-in-new-tab BUFFER ALIST)
Display BUFFER in a new tab.
ALIST is an association list of action symbols and values. See
Info node ‘(elisp) Buffer Display Action Alists’ for details of
such alists.
Like ‘display-buffer-in-tab’, but always creates a new tab unconditionally,
without checking if a suitable tab already exists.
If ALIST contains a ‘tab-name’ entry, it creates a new tab with that name
and displays BUFFER in a new tab. The ‘tab-name’ entry can be a function,
then it is called with two arguments: BUFFER and ALIST, and should return
the tab name. When a ‘tab-name’ entry is omitted, create a new tab without
an explicit name.
This is an action function for buffer display, see Info
node ‘(elisp) Buffer Display Action Functions’. It should be
called only by ‘display-buffer’ or a function directly or
indirectly called by the latter.
Não testado.
EDIT: Eu encontrei isso usando o sistema de ajuda do Emacs. Não uso tab-bar-modee não sabia disso de antemão, mas fazer C-h f display-buffer-TABme mostra um buffer de conclusão. Digitalizando rapidamente, encontrei display-buffer-in-tabe display-buffer-in-new-tab. Eu escolhi o último e peguei a string doc que colei acima.
Se o buffer de conclusão for muito longo para ser verificado facilmente a olho nu, você pode alternar para o buffer com C-x oe, em seguida, pesquisar, por exemplo, tabno buffer usando C-s.
Aprender a usar Helpe também a pesquisar os manuais Infoé um excelente investimento de seu tempo.