Eric S Fraga writes: > Hi, > > for those of us using more recent versions of Emacs, the new > tab-bar-mode can be quite useful. As I have been playing with, I > thought it would make sense to have the option for agenda views to > pop-up in a new tab as an option. I've coded something that behaves in > a similar way to the 'other-frame option that currently exists for > org-agenda-window-setup. > > Patch attached. Comments welcome, of course.
Thanks. Sounds fine to me. > Subject: [PATCH] added other-tab option for org-agenda-window-setup > > * org-agenda.el (org-agenda-prepare-window, org-agenda--quit): handle > other-tab option for agenda view creation and exit. Style conventions: s/added/Add/s/handle/Handle/ > --- > lisp/org-agenda.el | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el > index 8ebc882fc..abb969fe4 100644 > --- a/lisp/org-agenda.el > +++ b/lisp/org-agenda.el > @@ -1100,11 +1100,15 @@ reorganize-frame Show only two windows on the > current frame, the current > window and the agenda. > other-frame Use `switch-to-buffer-other-frame' to display agenda. > Also, when exiting the agenda, kill that frame. > +other-tab Use `switch-to-buffer-other-tab' to display the agenda. > + Also, kill that tab when exiting the agenda view. > + I think it's worth noting here which Emacs version gained tab support. > See also the variable `org-agenda-restore-windows-after-quit'." > :group 'org-agenda-windows > :type '(choice > (const current-window) > (const other-frame) > + (const other-tab) > (const other-window) > (const only-window) > (const reorganize-frame))) > @@ -1118,11 +1122,11 @@ It only matters if `org-agenda-window-setup' is > `reorganize-frame'." > [...] > @@ -3769,6 +3773,8 @@ FILTER-ALIST is an alist of filters we need to apply > when > (org-switch-to-buffer-other-window abuf)) > ((eq org-agenda-window-setup 'other-frame) > (switch-to-buffer-other-frame abuf)) > + ((eq org-agenda-window-setup 'other-tab) > + (switch-to-buffer-other-tab abuf)) > ((eq org-agenda-window-setup 'only-window) > (delete-other-windows) > (pop-to-buffer-same-window abuf)) > @@ -7389,6 +7395,8 @@ agenda." > (cond > ((eq org-agenda-window-setup 'other-frame) > (delete-frame)) > + ((eq org-agenda-window-setup 'other-tab) > + (tab-bar-close-tab)) > ((and org-agenda-restore-windows-after-quit > wconf) As you suggest in your follow-up message, you need to guard these calls for the sake of older versions. Perhaps something like (if (fboundp 'FN) (FN ...) (user-error "Your Emacs version doesn't support tabs")) in both spots. (That will silence the byte-compiler warnings too.)