From: Bhavin Gandhi <bhavin7392@gmail.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org, powem@ctpowe.net
Subject: Re: [BUG] org-auto-repeat-maybe: error "Can’t expand minibuffer to full frame" and missing log note
Date: Sun, 25 Sep 2022 23:46:50 +0530 [thread overview]
Message-ID: <CAOn=hbfmLiGW-QPpxyh2bfRoZnQr0N+SM1m+nErcYsfuuxGA2g@mail.gmail.com> (raw)
In-Reply-To: <878rnn19w0.fsf@localhost>
[-- Attachment #1: Type: text/plain, Size: 905 bytes --]
On Wed, 17 Aug 2022 at 15:14, Ihor Radchenko <yantar92@gmail.com> wrote:
> >> Yikes! Then, can also check for window-minibuffer-p, but I feel that it
> >> will be a fight against all kinds of edge cases.
> >
> > I haven't been able to make much progress on this bug in the last two
> > weeks. Will try to send a patch in a few days, as the steps I gave above
> > feels like an edge case which we won't see happening hopefully.
>
> Your patch will be already an improvement.
I'm attaching the patch for the current approach we discussed in this
thread. I have tried basic operations like taking note on state change,
and have tried with recurring entries which need more than 10 cycles to
be marked as done (original bug report).
As I was changing the indentation of code from org-add-log-note, I converted
some tabs to spaces, is it okay to do so?
--
Bhavin Gandhi (bhavin192) | https://geeksocket.in
[-- Attachment #2: 0001-org.el-Make-sure-org-add-log-note-runs-at-the-end-of.patch --]
[-- Type: text/x-patch, Size: 5136 bytes --]
From afb1158d9a360020f093436228cdf4e689474db8 Mon Sep 17 00:00:00 2001
From: Bhavin Gandhi <bhavin192@geeksocket.in>
Date: Sun, 25 Sep 2022 22:06:53 +0530
Subject: [PATCH] org.el: Make sure `org-add-log-note' runs at the end of Org
command
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* lisp/org.el (org-add-log-setup): Save `this-command' and
`recursion-depth' before adding the `org-add-log-note'to
post-command-hook.
(org-add-log-note): Execute only if the current `(recursion-depth)'
and `this-command' are same as the ones we saved during the log-setup.
This change tries to make sure that we run the `org-add-log-note' only
after the current Org command has finished executing. Previously, the
post-command-hook was getting triggered if the Org command in turn
runs some other command.
Fixes the bug originally reported by Michael Powe.
Bhavin Gandhi. [BUG] org-auto-repeat-maybe: error "Can’t expand
minibuffer to full frame" and missing log note.
Sat, 18 Jun 2022 23:30:50 +0530.
https://list.orgmode.org/CAOn=hbcsOCO++We0XgRHFoxxCEXROCpyGd1nCjzKYy-9LckQZg@mail.gmail.com/
Relevant discussion on bug-gnu-emacs: https://debbugs.gnu.org/56425
---
lisp/org.el | 64 ++++++++++++++++++++++++++++-------------------------
1 file changed, 34 insertions(+), 30 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index b63aaed4f..ba20df59f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10355,6 +10355,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))
@@ -10383,37 +10385,39 @@ 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."
- (remove-hook 'post-command-hook 'org-add-log-note)
- (setq org-log-setup nil)
- (setq org-log-note-window-configuration (current-window-configuration))
- (delete-other-windows)
- (move-marker org-log-note-return-to (point))
- (pop-to-buffer-same-window (marker-buffer org-log-note-marker))
- (goto-char org-log-note-marker)
- (org-switch-to-buffer-other-window "*Org Note*")
- (erase-buffer)
- (if (memq org-log-note-how '(time state))
- (org-store-log-note)
- (let ((org-inhibit-startup t)) (org-mode))
- (insert (format "# Insert note for %s.
+ (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))
+ (delete-other-windows)
+ (move-marker org-log-note-return-to (point))
+ (pop-to-buffer-same-window (marker-buffer org-log-note-marker))
+ (goto-char org-log-note-marker)
+ (org-switch-to-buffer-other-window "*Org Note*")
+ (erase-buffer)
+ (if (memq org-log-note-how '(time state))
+ (org-store-log-note)
+ (let ((org-inhibit-startup t)) (org-mode))
+ (insert (format "# Insert note for %s.
# Finish with C-c C-c, or cancel with C-c C-k.\n\n"
- (cl-case org-log-note-purpose
- (clock-out "stopped clock")
- (done "closed todo item")
- (reschedule "rescheduling")
- (delschedule "no longer scheduled")
- (redeadline "changing deadline")
- (deldeadline "removing deadline")
- (refile "refiling")
- (note "this entry")
- (state
- (format "state change from \"%s\" to \"%s\""
- (or org-log-note-previous-state "")
- (or org-log-note-state "")))
- (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)))
+ (cl-case org-log-note-purpose
+ (clock-out "stopped clock")
+ (done "closed todo item")
+ (reschedule "rescheduling")
+ (delschedule "no longer scheduled")
+ (redeadline "changing deadline")
+ (deldeadline "removing deadline")
+ (refile "refiling")
+ (note "this entry")
+ (state
+ (format "state change from \"%s\" to \"%s\""
+ (or org-log-note-previous-state "")
+ (or org-log-note-state "")))
+ (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))))
(defvar org-note-abort nil) ; dynamically scoped
(defun org-store-log-note ()
--
2.37.3
next prev parent reply other threads:[~2022-09-25 18:18 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
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 [this message]
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:
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='CAOn=hbfmLiGW-QPpxyh2bfRoZnQr0N+SM1m+nErcYsfuuxGA2g@mail.gmail.com' \
--to=bhavin7392@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=powem@ctpowe.net \
--cc=yantar92@gmail.com \
/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).