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.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-719-gcdfc40.dirty
>From e715a495f9659a5cef39e25822e18651ecefcf32 Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fr...@ucl.ac.uk>
Date: Wed, 26 Aug 2020 17:17:42 +0100
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.
---
 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.
+
 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'."
 
 (defcustom org-agenda-restore-windows-after-quit nil
   "Non-nil means restore window configuration upon exiting agenda.
-Before the window configuration is changed for displaying the agenda,
-the current status is recorded.  When the agenda is exited with
-`q' or `x' and this option is set, the old state is restored.  If
-`org-agenda-window-setup' is `other-frame', the value of this
-option will be ignored."
+Before the window configuration is changed for displaying the
+agenda, the current status is recorded.  When the agenda is
+exited with `q' or `x' and this option is set, the old state is
+restored.  If `org-agenda-window-setup' is `other-frame' or
+`other-tab', the value of this option will be ignored."
   :group 'org-agenda-windows
   :type 'boolean)
 
@@ -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)
 	;; Maybe restore the pre-agenda window configuration.  Reset
-- 
2.28.0

Reply via email to