emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: emacs-orgmode@gnu.org
Subject: Re: new feature for consideration: other-tab for org-agenda-window-setup
Date: Wed, 26 Aug 2020 18:28:12 -0400	[thread overview]
Message-ID: <87k0xlm48z.fsf@kyleam.com> (raw)
In-Reply-To: <87eentqsws.fsf@ucl.ac.uk>

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.)


  parent reply	other threads:[~2020-08-26 22:28 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 [this message]
2020-08-27  9:50   ` Eric S Fraga
2020-08-27 10:51     ` Kyle Meyer
2020-08-27 19:31       ` Eric S Fraga
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=87k0xlm48z.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    /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).