emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Kyle Meyer <kyle@kyleam.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: new feature for consideration: other-tab for org-agenda-window-setup
Date: Thu, 27 Aug 2020 20:31:07 +0100	[thread overview]
Message-ID: <87imd33mys.fsf@ucl.ac.uk> (raw)
In-Reply-To: <878se0qs4o.fsf@kyleam.com> (Kyle Meyer's message of "Thu, 27 Aug 2020 06:51:03 -0400")

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

Dear all,

Please see attached for a new version of my changes for adding
'other-tab as an option for org-agenda-window-setup.

I think I've addressed all your comments, Kyle, but any more are
welcome.  It would be good if somebody who is using an older version of
Emacs, i.e. pre 27.1, could test the error handling: set
org-agenda-window-setup to 'other-tab and see if it fails properly.  I
only have v28.x on my systems!

On v28.x, it seems to be working fine.

thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-720-gbe5916

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-other-tab-option-for-org-agenda-window-setup.patch --]
[-- Type: text/x-diff, Size: 4082 bytes --]

From be5916aba7031cd2343d3e59a98a47496ced95f2 Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fraga@ucl.ac.uk>
Date: Wed, 26 Aug 2020 17:17:42 +0100
Subject: [PATCH] Add 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.
---
 etc/ORG-NEWS       |  6 ++++++
 lisp/org-agenda.el | 27 +++++++++++++++++++++------
 2 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 8a3589ec2..6d8db0e18 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -291,6 +291,12 @@ possible via column view value edit or with =<C-c C-q>=.
 Counterpart of ~org-show-entry~.
 
 ** New options
+*** New option for using tabs in ~org-agenda-window-setup~
+
+Choosing ~other-tab~ for ~org-agenda-window-setup~ will open the
+agenda view in a new tab.  This will work with versions of Emacs since
+27.1 when ~tab-bar-mode~ was introduced.
+
 *** New option ~org-clock-auto-clockout-timer~
 
 When this option is set to a number and the user configuration
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 8ebc882fc..fd30e6d81 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1100,14 +1100,21 @@ 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, making use of the `tab-bar-mode' introduced
+                  in Emacs version 27.1.  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)))
+	  (const reorganize-frame))
+  :package-version '(Org . "9.4"))
 
 (defcustom org-agenda-window-frame-fractions '(0.5 . 0.75)
   "The min and max height of the agenda window as a fraction of frame height.
@@ -1118,11 +1125,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 +3776,10 @@ 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)
+      (if (fboundp 'switch-to-buffer-other-tab)
+	  (switch-to-buffer-other-tab abuf)
+	(user-error "Your version of Emacs does not have tab bar support.")))
      ((eq org-agenda-window-setup 'only-window)
       (delete-other-windows)
       (pop-to-buffer-same-window abuf))
@@ -7389,6 +7400,10 @@ agenda."
       (cond
        ((eq org-agenda-window-setup 'other-frame)
 	(delete-frame))
+       ((eq org-agenda-window-setup 'other-tab)
+	(if (fboundp 'tab-bar-close-tab)
+	    (tab-bar-close-tab)
+	  (user-error "Your version of Emacs does not have tab bar mode support.")))
        ((and org-agenda-restore-windows-after-quit
 	     wconf)
 	;; Maybe restore the pre-agenda window configuration.  Reset
-- 
2.28.0


  reply	other threads:[~2020-08-27 19:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 16:21 new feature for consideration: other-tab for org-agenda-window-setup Eric S Fraga
2020-08-26 16:28 ` Eric S Fraga
2020-08-26 22:28 ` Kyle Meyer
2020-08-27  9:50   ` Eric S Fraga
2020-08-27 10:51     ` Kyle Meyer
2020-08-27 19:31       ` Eric S Fraga [this message]
2020-08-28  4:27         ` Kyle Meyer
2020-08-29 12:07           ` Kyle Meyer
2020-08-31 13:09             ` Eric S Fraga
2020-09-03 10:16             ` Bastien
2020-09-03 12:29 ` Bastien
2020-09-03 21:26   ` Eric S Fraga
2020-09-04  7:06     ` Bastien
2020-09-04  7:50       ` Eric S Fraga
2020-09-03 21:28   ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imd33mys.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).