* [PATCH] Allow org-capture-mode-hook to access org-capture-current-plist [9.3.6 (release_9.3.6-443-g0e8aff @ /home/n/.emacs.d/straight/build/org/)]
@ 2020-05-03 17:40 No Wayman
2020-05-07 19:53 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: No Wayman @ 2020-05-03 17:40 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
I'm proposing the following trivial patch to bring more
consistency to org-capture-mode's hooks.
By setting org-capture-current-plist before invoking
org-capture-mode in the capture buffer, users
can access the same variable in org-capture-mode-hook as they
would in org-capture-before-finalize-hook and
org-capture-prepare-finalize-hook.
org-capture-after-finalize-hook is the only outlier, but that
makes sense as the capture buffer is no longer current when it
runs.
~ Nicholas Vollmer
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: set-org-capture-current-plist-before-org-capture-mode-hook-run --]
[-- Type: text/x-patch, Size: 1127 bytes --]
From 0e8affeaea6034655bbd53faa412eed0826a7933 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Sun, 3 May 2020 13:20:05 -0400
Subject: [PATCH] Allow org-capture-mode-hook to access
org-capture-current-plist
Set buffer local org-capture-current-plist before putting capture buffer
in org-capture-mode. Allows hook functions to access the buffer local
version on the plist (consistent with before/prepare-finalize hooks).
---
lisp/org-capture.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index d292defd6..f650c5473 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1128,8 +1128,8 @@ may have been stored before."
(`plain (org-capture-place-plain-text))
(`item (org-capture-place-item))
(`checkitem (org-capture-place-item)))
- (org-capture-mode 1)
- (setq-local org-capture-current-plist org-capture-plist))
+ (setq-local org-capture-current-plist org-capture-plist)
+ (org-capture-mode 1))
(defun org-capture-place-entry ()
"Place the template as a new Org entry."
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow org-capture-mode-hook to access org-capture-current-plist [9.3.6 (release_9.3.6-443-g0e8aff @ /home/n/.emacs.d/straight/build/org/)]
2020-05-03 17:40 [PATCH] Allow org-capture-mode-hook to access org-capture-current-plist [9.3.6 (release_9.3.6-443-g0e8aff @ /home/n/.emacs.d/straight/build/org/)] No Wayman
@ 2020-05-07 19:53 ` Nicolas Goaziou
2020-06-08 18:49 ` No Wayman
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2020-05-07 19:53 UTC (permalink / raw)
To: No Wayman; +Cc: emacs-orgmode
Hello,
No Wayman <iarchivedmywholelife@gmail.com> writes:
> I'm proposing the following trivial patch to bring more consistency to
> org-capture-mode's hooks.
> By setting org-capture-current-plist before invoking org-capture-mode
> in the capture buffer, users
> can access the same variable in org-capture-mode-hook as they would in
> org-capture-before-finalize-hook and
> org-capture-prepare-finalize-hook.
> org-capture-after-finalize-hook is the only outlier, but that makes
> sense as the capture buffer is no longer current when it runs.
OK.
Could you add the modified function in the commit message, add
TINYCHANGE cookie if you haven't signed FSF papers yet, and add an entry
in ORG-NEWS about it?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow org-capture-mode-hook to access org-capture-current-plist [9.3.6 (release_9.3.6-443-g0e8aff @ /home/n/.emacs.d/straight/build/org/)]
2020-05-07 19:53 ` Nicolas Goaziou
@ 2020-06-08 18:49 ` No Wayman
2020-06-10 17:43 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: No Wayman @ 2020-06-08 18:49 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode, N V
[-- Attachment #1: Type: text/plain, Size: 406 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Could you add the modified function in the commit message, add
> TINYCHANGE cookie if you haven't signed FSF papers yet, and add
> an entry
> in ORG-NEWS about it?
I've modified the commit message and added an ORG-NEWS entry in
the attached patch.
My FSF papers have recently cleared, so we should be good in that
regard.
Thanks,
Nicholas Vollmer
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: set-org-capture-current-plist-before-org-capture-mode-hook --]
[-- Type: text/x-patch, Size: 1745 bytes --]
From 0590973aa7d487ed014ed6bcb5db6459b07218ab Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Mon, 8 Jun 2020 14:19:35 -0400
Subject: [PATCH] lisp/org-capture.el: Set `org-capture-current-plist' before
`org-capture-mode-hook'
* org-capture.el (org-capture-place-template): Allow `org-capture-current-plist' access during `org-capture-mode-hook'
Ensure consistency between org-capture's hooks.
`org-capture-after-finalize-hook' is now the only hook that cannot
access `org-capture-current-plst' because the capture buffer is killed
when it is run.
---
etc/ORG-NEWS | 1 +
lisp/org-capture.el | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index f7c898f84..8db9db645 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -478,6 +478,7 @@ function, ~org-edit-latex-fragment~. This functions in a comparable
manner to editing inline source blocks, bringing up a minibuffer set
to LaTeX mode. The math-mode deliminators are read only.
+*** org-capture: ~org-capture-current-plist~ accessible during ~org-capture-mode-hook~
* Version 9.3
** Incompatible changes
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 9136d331b..7dde7e194 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1128,8 +1128,8 @@ may have been stored before."
(`plain (org-capture-place-plain-text))
(`item (org-capture-place-item))
(`checkitem (org-capture-place-item)))
- (org-capture-mode 1)
- (setq-local org-capture-current-plist org-capture-plist))
+ (setq-local org-capture-current-plist org-capture-plist)
+ (org-capture-mode 1))
(defun org-capture-place-entry ()
"Place the template as a new Org entry."
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Allow org-capture-mode-hook to access org-capture-current-plist [9.3.6 (release_9.3.6-443-g0e8aff @ /home/n/.emacs.d/straight/build/org/)]
2020-06-08 18:49 ` No Wayman
@ 2020-06-10 17:43 ` Nicolas Goaziou
2020-06-11 6:31 ` Bastien
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2020-06-10 17:43 UTC (permalink / raw)
To: No Wayman; +Cc: Bastien Guerry, emacs-orgmode
Hello,
No Wayman <iarchivedmywholelife@gmail.com> writes:
> Subject: [PATCH] lisp/org-capture.el: Set `org-capture-current-plist' before
> `org-capture-mode-hook'
>
> * org-capture.el (org-capture-place-template): Allow
> `org-capture-current-plist' access during `org-capture-mode-hook'
Thank you.
We're in feature freeze, but since the change was very small, and was
discussed a while before I applied it nonetheless.
I'm cc'ing Bastien for the heads-up, if he wants to revert this for 9.4
release.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-11 6:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-03 17:40 [PATCH] Allow org-capture-mode-hook to access org-capture-current-plist [9.3.6 (release_9.3.6-443-g0e8aff @ /home/n/.emacs.d/straight/build/org/)] No Wayman
2020-05-07 19:53 ` Nicolas Goaziou
2020-06-08 18:49 ` No Wayman
2020-06-10 17:43 ` Nicolas Goaziou
2020-06-11 6:31 ` Bastien
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).