emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Allow org-agenda-switch-to to restore the previous window configuration
@ 2023-03-01 11:44 Marvin J.
  2023-03-29 13:44 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Marvin J. @ 2023-03-01 11:44 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Allow org-agenda-switch-to to restore the previous window configuration
  2023-03-01 11:44 Allow org-agenda-switch-to to restore the previous window configuration Marvin J.
@ 2023-03-29 13:44 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-03-29 13:44 UTC (permalink / raw)
  To: Marvin J.; +Cc: emacs-orgmode

"Marvin J." <silbersplitter@googlemail.com> writes:

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

Note that you can still achieve what you want using `org-agenda-after-show-hook'.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-29 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 11:44 Allow org-agenda-switch-to to restore the previous window configuration Marvin J.
2023-03-29 13:44 ` Ihor Radchenko

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