emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Marvin J." <silbersplitter@googlemail.com>
To: emacs-orgmode@gnu.org
Subject: Allow org-agenda-switch-to to restore the previous window configuration
Date: Wed, 1 Mar 2023 12:44:06 +0100	[thread overview]
Message-ID: <CAH7LOt1Cu0vfQ83q9nt=UpLXQtoUSVKM0acd-rFCXONLQUHowA@mail.gmail.com> (raw)

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

Org-agenda provides the possibility to automatically restore the previous
window configuration after closing the agenda buffer using org-agenda-quit
(bound to q). This is achieved by setting
org-agenda-restore-windows-after-quit to t.

However, there is also another way to "exit" the agenda, namely by calling
org-agenda-switch-to (bound to RET) on an appropriate item. However, this
command currently does not take the previous window configuration into
account.

I thus propose adding a new variable named e.g.
org-agenda-restore-windows-after-switch that controls whether the command
org-agenda-switch-to will restore the previous window configuration before
switching to the Org mode file of the item at point.

An example scenario where this is useful: Suppose you have a sophisticated
window configuration and call org agenda with org-agenda-window-setup set
to only-window. Then you want that window configuration to be restored also
when exiting the agenda view via org-agenda-switch-to. Otherwise, you would
lose your precious window configuration.

This behavior could be achieved by adding something like

(when (and org-agenda-restore-windows-after-switch
org-agenda-pre-window-conf)
  (set-window-configuration org-agenda-pre-window-conf))

before the call of pop-to-buffer-same-window within org-agenda-switch-to.

[-- Attachment #2: Type: text/html, Size: 1434 bytes --]

             reply	other threads:[~2023-03-01 11:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 11:44 Marvin J. [this message]
2023-03-29 13:44 ` Allow org-agenda-switch-to to restore the previous window configuration Ihor Radchenko

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='CAH7LOt1Cu0vfQ83q9nt=UpLXQtoUSVKM0acd-rFCXONLQUHowA@mail.gmail.com' \
    --to=silbersplitter@googlemail.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).