emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bhavin Gandhi <bhavin7392@gmail.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-auto-repeat-maybe: error "Can’t expand minibuffer to full frame" and missing log note
Date: Thu, 21 Jul 2022 23:33:31 +0530	[thread overview]
Message-ID: <CAOn=hbeXHJodZewn+DtDA6-jB30s8az0NXGM+FuX+EV5F2qiFg@mail.gmail.com> (raw)
In-Reply-To: <87zgh9ct01.fsf@localhost>

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

On Sat, 16 Jul 2022 at 14:50, Ihor Radchenko <yantar92@gmail.com> wrote:
> > Seems like soon I will cross the TINYCHANGE limit, so I will get the
> > FSF copyright assignment done.
> Note that FSF should reply within 5 working days. If not, we can help
> you to push them.

Thanks! I received the PDF to sign the next day after my email, this
will probably take a couple of days more from my side as I'm talking
with my employer.

> Thanks for the idea, I'm exploring (recursion-depth),
> (minibuffer-depth). I will come up with a patch to fix this bug.

So, I saved this-command and (recursion-depth) value, and I'm checking
for it in the org-add-log-note (attaching diff of my changes). But this
doesn't guarantee that we are not in the minibuffer when the
post-command-hook runs.

This is what I did, and it failed after answering the question about 10
repeated intervals:
1. M-: (y-or-n-p "Some question")
2. Now I switched to Org mode buffer.
3. Did C-c C-t on the entry.

When org-log-add-setup runs, (recursion-depth) is 1, and
(minibuffer-depth) is also 1.
Now, the question about 10 repeated intervals is asked, once I answer
it, post-command-hook runs. And it runs while we are in the minibuffer
waiting for 'Some question'.

So, I changed the second condition to (= (minibuffer-depth) 0).
This has a different effect when org-todo finishes the execution and we
are still in minibuffer:
this-command won't be org-todo again unless it is invoked again by the
user. org-add-log-note post-command-hook is never removed, and it keeps
executing as the condition is not fulfilled.

I'm going through the code of org-add-log-note to see if we can avoid
calling (delete-other-windows) in the minibuffer. Or move out of minibuffer
and then proceed.

[-- Attachment #2: org-add-log-note-minibuffer.diff --]
[-- Type: text/x-patch, Size: 1433 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 3d4de5b4f..978850199 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10146,6 +10146,8 @@ EXTRA is additional text that will be inserted into the notes buffer."
 	org-log-note-how how
 	org-log-note-extra extra
 	org-log-note-effective-time (org-current-effective-time)
+        org-log-note-this-command this-command
+        org-log-note-recursion-depth (recursion-depth)
         org-log-setup t)
   (add-hook 'post-command-hook 'org-add-log-note 'append))
@@ -10174,6 +10176,8 @@ EXTRA is additional text that will be inserted into the notes buffer."
 (defun org-add-log-note (&optional _purpose)
   "Pop up a window for taking a note, and add this note later."
+  (when (and (equal org-log-note-this-command this-command)
+             (= org-log-note-recursion-depth (recursion-depth)))
   (remove-hook 'post-command-hook 'org-add-log-note)
   (setq org-log-setup nil)
   (setq org-log-note-window-configuration (current-window-configuration))
@@ -10204,7 +10208,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
 		      (t (error "This should not happen")))))
     (when org-log-note-extra (insert org-log-note-extra))
     (setq-local org-finish-function 'org-store-log-note)
-    (run-hooks 'org-log-buffer-setup-hook)))
+    (run-hooks 'org-log-buffer-setup-hook))))
 (defvar org-note-abort nil) ; dynamically scoped
 (defun org-store-log-note ()

  reply	other threads:[~2022-07-21 18:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-12 15:48 Org Agenda Error Michael Powe
2022-06-12 17:46 ` Bhavin Gandhi
2022-06-13  3:29   ` Michael Powe
2022-06-13 17:31   ` Bhavin Gandhi
2022-06-18 18:00     ` [BUG] org-auto-repeat-maybe: error "Can’t expand minibuffer to full frame" and missing log note Bhavin Gandhi
2022-07-01  2:14       ` Ihor Radchenko
2022-07-03 17:10         ` Bhavin Gandhi
2022-07-04 12:03           ` Ihor Radchenko
2022-07-10 17:23             ` Bhavin Gandhi
2022-07-11  1:57               ` Ihor Radchenko
2022-07-14 15:22                 ` Bhavin Gandhi
2022-07-16  9:21                   ` Ihor Radchenko
2022-07-21 18:03                     ` Bhavin Gandhi [this message]
2022-07-26 11:49                       ` Ihor Radchenko
2022-08-16 18:17                         ` Bhavin Gandhi
2022-08-17  9:45                           ` Ihor Radchenko
2022-09-01  9:48                             ` Bastien Guerry
2022-09-25 18:16                             ` Bhavin Gandhi
2022-09-26 12:46                               ` 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:

  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='CAOn=hbeXHJodZewn+DtDA6-jB30s8az0NXGM+FuX+EV5F2qiFg@mail.gmail.com' \
    --to=bhavin7392@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \


* 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


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