`org-capture' does not pass its KEYS argument to `org-capture-goto-target'. (Must not be a common use-case, as git blame points to org-capture's introduction 10 years ago!)

The attached patch does just that.
Wasn't sure if this was worthy of a NEWS entry. Will add if needed.

Thanks,
Nicholas Vollmer

>From 4aa4dd120a74679afe33b7fe603035dd0379441a Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholel...@gmail.com>
Date: Wed, 1 Jul 2020 13:43:29 -0400
Subject: [PATCH] capture: org-capture pass KEYS with GOTO arg

* org-capture.el (org-capture): pass `keys' arg to `org-capture-goto-target'.

Allows programmatically visiting a specific template.
---
 lisp/org-capture.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index cc91251e0..2cc1ce394 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -628,7 +628,7 @@ of the day at point (if any) or the current HH:MM time."
     (setq org-overriding-default-time
 	  (org-get-cursor-date (equal goto 1))))
   (cond
-   ((equal goto '(4)) (org-capture-goto-target))
+   ((equal goto '(4))  (org-capture-goto-target keys))
    ((equal goto '(16)) (org-capture-goto-last-stored))
    (t
     (let* ((orig-buf (current-buffer))
-- 
2.27.0

Reply via email to