emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Org agenda misbehaves in a side window [9.5 (9.5-g0a86ad @ /home/zellerin/.emacs.d/elpa/org-9.5/)]
@ 2023-01-05 13:42 Tomas Zellerin
  2023-01-06 14:54 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Tomas Zellerin @ 2023-01-05 13:42 UTC (permalink / raw)
  To: emacs-orgmode


When Agenda buffer is in a side window, several actions fail with
"Cannot make side window the only window".

Example:

emacs -Q
in *scratch*, (setq display-buffer-alist '(("\\*Org Agenda\\*"
display-buffer-in-side-window)))
M-x org-agenda t to display Todo agenda
in org-agenda buffer, another M-x org-agenda is observed fails with error above,
expected is display the menu to select agenda command

Other failing commands are for example changes of todo state in agenda
buffer.

The reason seems that org-agenda-get-restriction-and-command calls
delete-other-window; however, this is not something user observes and
expects as effect of those commands.

Observed on Org 9.6 as well.

Emacs  : GNU Emacs 29.0.60 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.35, cairo version 1.17.6)
 of 2022-12-22
Package: Org mode version 9.5 (9.5-g0a86ad @ /home/zellerin/.emacs.d/elpa/org-9.5/)


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

* Re: [BUG] Org agenda misbehaves in a side window [9.5 (9.5-g0a86ad @ /home/zellerin/.emacs.d/elpa/org-9.5/)]
  2023-01-05 13:42 [BUG] Org agenda misbehaves in a side window [9.5 (9.5-g0a86ad @ /home/zellerin/.emacs.d/elpa/org-9.5/)] Tomas Zellerin
@ 2023-01-06 14:54 ` Ihor Radchenko
  2023-01-06 18:48   ` Tomas Zellerin
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ihor Radchenko @ 2023-01-06 14:54 UTC (permalink / raw)
  To: Tomas Zellerin; +Cc: emacs-orgmode

Tomas Zellerin <tomas@zellerin.cz> writes:

> When Agenda buffer is in a side window, several actions fail with
> "Cannot make side window the only window".
>
> Example:
>
> emacs -Q
> in *scratch*, (setq display-buffer-alist '(("\\*Org Agenda\\*"
> display-buffer-in-side-window)))
> M-x org-agenda t to display Todo agenda
> in org-agenda buffer, another M-x org-agenda is observed fails with error above,
> expected is display the menu to select agenda command

Confirmed.

> Other failing commands are for example changes of todo state in agenda
> buffer.
>
> The reason seems that org-agenda-get-restriction-and-command calls
> delete-other-window; however, this is not something user observes and
> expects as effect of those commands.

Sure, but what can we do in order to both fix this and also not break
the existing behaviour?

-- 
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] 5+ messages in thread

* Re: [BUG] Org agenda misbehaves in a side window [9.5 (9.5-g0a86ad @ /home/zellerin/.emacs.d/elpa/org-9.5/)]
  2023-01-06 14:54 ` Ihor Radchenko
@ 2023-01-06 18:48   ` Tomas Zellerin
  2023-01-07 20:11   ` Jean Louis
  2024-04-07 10:41   ` Ihor Radchenko
  2 siblings, 0 replies; 5+ messages in thread
From: Tomas Zellerin @ 2023-01-06 18:48 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

>> The reason seems that org-agenda-get-restriction-and-command calls
>> delete-other-window; however, this is not something user observes and
>> expects as effect of those commands.
>
> Sure, but what can we do in order to both fix this and also not break
> the existing behaviour?

The simplest solution seems to bind (ignore-window-parameters t) inside
the save-window-excursion in `org-agenda-get-restriction-and-command`,
see below. But I do not know what all can be broken, or whether
something cleaner is possible.

Best regards,

Tomas

--- /tmp/org-agenda.orig	2023-01-06 19:43:03.528884719 +0100
+++ /tmp/org-agenda.el	2023-01-06 19:41:23.493330904 +0100
@@ -3112,13 +3112,14 @@
 	   c entry key type match prefixes rmheader header-end custom1 desc
 	   line lines left right n n1)
       (save-window-excursion
-	(delete-other-windows)
-	(org-switch-to-buffer-other-window " *Agenda Commands*")
-	(erase-buffer)
-	(insert (eval-when-compile
-		  (let ((header
-			 (copy-sequence
-			  "Press key for an agenda command:
+        (let ((ignore-window-parameters t))
+          (delete-other-windows)
+          (org-switch-to-buffer-other-window " *Agenda Commands*")
+          (erase-buffer)
+          (insert (eval-when-compile
+                    (let ((header
+                           (copy-sequence
+                            "Press key for an agenda command:
 --------------------------------        <   Buffer, subtree/region restriction
 a   Agenda for current week or day      >   Remove restriction
 t   List of all TODO entries            e   Export agenda views
@@ -3128,14 +3129,14 @@
 ?   Find :FLAGGED: entries              C   Configure custom agenda commands
 *   Toggle sticky agenda views          #   List stuck projects (!=configure)
 "))
-			(start 0))
-		    (while (string-match
-			    "\\(^\\|   \\|(\\)\\(\\S-\\)\\( \\|=\\)"
-			    header start)
-		      (setq start (match-end 0))
-		      (add-text-properties (match-beginning 2) (match-end 2)
-					   '(face bold) header))
-		    header)))
+                          (start 0))
+                      (while (string-match
+                              "\\(^\\|   \\|(\\)\\(\\S-\\)\\( \\|=\\)"
+                              header start)
+                        (setq start (match-end 0))
+                        (add-text-properties (match-beginning 2) (match-end 2)
+                                             '(face bold) header))
+                      header))))
 	(setq header-end (point-marker))
 	(while t
 	  (setq custom1 custom)


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

* Re: [BUG] Org agenda misbehaves in a side window [9.5 (9.5-g0a86ad @ /home/zellerin/.emacs.d/elpa/org-9.5/)]
  2023-01-06 14:54 ` Ihor Radchenko
  2023-01-06 18:48   ` Tomas Zellerin
@ 2023-01-07 20:11   ` Jean Louis
  2024-04-07 10:41   ` Ihor Radchenko
  2 siblings, 0 replies; 5+ messages in thread
From: Jean Louis @ 2023-01-07 20:11 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Tomas Zellerin, emacs-orgmode

* Ihor Radchenko <yantar92@posteo.net> [2023-01-06 17:56]:
> Tomas Zellerin <tomas@zellerin.cz> writes:
> 
> > When Agenda buffer is in a side window, several actions fail with
> > "Cannot make side window the only window".
> >
> > Example:
> >
> > emacs -Q
> > in *scratch*, (setq display-buffer-alist '(("\\*Org Agenda\\*"
> > display-buffer-in-side-window)))
> > M-x org-agenda t to display Todo agenda
> > in org-agenda buffer, another M-x org-agenda is observed fails with error above,
> > expected is display the menu to select agenda command
> 
> Confirmed.
> 
> > Other failing commands are for example changes of todo state in agenda
> > buffer.
> >
> > The reason seems that org-agenda-get-restriction-and-command calls
> > delete-other-window; however, this is not something user observes and
> > expects as effect of those commands.
> 
> Sure, but what can we do in order to both fix this and also not break
> the existing behaviour?

You can do this:

GNU Emacs package: rcd-org-agenda-dashboard.el -- RCD Org Agenda Dashboard:
https://gnu.support/gnu-emacs/packages/GNU-Emacs-package-rcd-org-agenda-dashboard-el-RCD-Org-Agenda-Dashboard-76669.html

Follow same principles for Org Agenda, liberate it into derived mode
where people use it just as any other Emacs buffer.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/


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

* Re: [BUG] Org agenda misbehaves in a side window [9.5 (9.5-g0a86ad @ /home/zellerin/.emacs.d/elpa/org-9.5/)]
  2023-01-06 14:54 ` Ihor Radchenko
  2023-01-06 18:48   ` Tomas Zellerin
  2023-01-07 20:11   ` Jean Louis
@ 2024-04-07 10:41   ` Ihor Radchenko
  2 siblings, 0 replies; 5+ messages in thread
From: Ihor Radchenko @ 2024-04-07 10:41 UTC (permalink / raw)
  To: Tomas Zellerin; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Confirmed.
>
>> Other failing commands are for example changes of todo state in agenda
>> buffer.
>>
>> The reason seems that org-agenda-get-restriction-and-command calls
>> delete-other-window; however, this is not something user observes and
>> expects as effect of those commands.
>
> Sure, but what can we do in order to both fix this and also not break
> the existing behaviour?

I found a way.
Fixed, on main. And we now honour `display-buffer-alist' everywhere as a
bonus (or rather this bug is fixed as a bonus of honouring `display-buffer-alist').
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=18fbb9985

-- 
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] 5+ messages in thread

end of thread, other threads:[~2024-04-07 10:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-05 13:42 [BUG] Org agenda misbehaves in a side window [9.5 (9.5-g0a86ad @ /home/zellerin/.emacs.d/elpa/org-9.5/)] Tomas Zellerin
2023-01-06 14:54 ` Ihor Radchenko
2023-01-06 18:48   ` Tomas Zellerin
2023-01-07 20:11   ` Jean Louis
2024-04-07 10:41   ` 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).