emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: No Wayman <iarchivedmywholelife@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [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/)]
Date: Sun, 03 May 2020 13:40:41 -0400	[thread overview]
Message-ID: <87r1w07w86.fsf@gmail.com> (raw)

[-- 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-after-finalize-hook is the only outlier, but that 
makes sense as the capture buffer is no longer current when it 

~ 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

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

             reply	other threads:[~2020-05-03 17:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 17:40 No Wayman [this message]
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

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=87r1w07w86.fsf@gmail.com \
    --to=iarchivedmywholelife@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='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/)]' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).