* [PATCH] org-capture.el: Allow `(here)' as a template target
@ 2023-05-12 15:35 Tim Visher
2023-05-12 16:35 ` Ihor Radchenko
0 siblings, 1 reply; 2+ messages in thread
From: Tim Visher @ 2023-05-12 15:35 UTC (permalink / raw)
To: Emacs Org Mode mailing list
[-- Attachment #1.1: Type: text/plain, Size: 1809 bytes --]
Hi Everyone,
I think this should likely involve an update to the manual but I don't want
to bother doing that unless the basic approach is approved.
-----
From eccc3f8f805c38b1de55fc8ad60c67a87e2feea4 Mon Sep 17 00:00:00 2001
From: Tim Visher <tim.visher@gmail.com>
Date: Fri, 12 May 2023 11:32:21 -0400
Subject: [PATCH] org-capture.el: Allow `(here)' as a template target
* lisp/org-capture.el (org-capture-set-target-location): Allow `(here)' as
a template
target in addition to `here'.
Templates had no user accessible way to target the current location
directly from a capture template. Attempting to directly utilize the
behavior accessible through a 0 prefix arg exposed the inconsistent
treatment of the `:target` property in
`org-capture`. `org-capture-set-target-location` understood that it
could be both a symbol and a list, while `org-capture` itself required
it to be a list through its use of `car`.
This change opts to make `org-capture-set-target-location` more
liberal in what it accepts rather than making `org-capture` agree that
targets can be lists. This is because the manual implies, especially
in the `(clock)' entry, that targets are expected to be lists even if
they are meant as specific points.
TINYCHANGE
---
lisp/org-capture.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index d4311dd20..f14e95c5c 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -991,7 +991,8 @@ Store them in the capture property list."
(let ((target-entry-p t))
(save-excursion
(pcase (or target (org-capture-get :target))
- (`here
+ ((or `here
+ `(here))
(org-capture-put :exact-position (point) :insert-here t))
(`(file ,path)
(set-buffer (org-capture-target-buffer path))
--
2.40.1
[-- Attachment #1.2: Type: text/html, Size: 2133 bytes --]
[-- Attachment #2: 0001-org-capture.el-Allow-here-as-a-template-target.patch --]
[-- Type: application/octet-stream, Size: 1654 bytes --]
From eccc3f8f805c38b1de55fc8ad60c67a87e2feea4 Mon Sep 17 00:00:00 2001
From: Tim Visher <tim.visher@gmail.com>
Date: Fri, 12 May 2023 11:32:21 -0400
Subject: [PATCH] org-capture.el: Allow `(here)' as a template target
* lisp/org-capture.el (org-capture-set-target-location): Allow `(here)' as a template
target in addition to `here'.
Templates had no user accessible way to target the current location
directly from a capture template. Attempting to directly utilize the
behavior accessible through a 0 prefix arg exposed the inconsistent
treatment of the `:target` property in
`org-capture`. `org-capture-set-target-location` understood that it
could be both a symbol and a list, while `org-capture` itself required
it to be a list through its use of `car`.
This change opts to make `org-capture-set-target-location` more
liberal in what it accepts rather than making `org-capture` agree that
targets can be lists. This is because the manual implies, especially
in the `(clock)' entry, that targets are expected to be lists even if
they are meant as specific points.
TINYCHANGE
---
lisp/org-capture.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index d4311dd20..f14e95c5c 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -991,7 +991,8 @@ Store them in the capture property list."
(let ((target-entry-p t))
(save-excursion
(pcase (or target (org-capture-get :target))
- (`here
+ ((or `here
+ `(here))
(org-capture-put :exact-position (point) :insert-here t))
(`(file ,path)
(set-buffer (org-capture-target-buffer path))
--
2.40.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
2023-05-12 15:35 [PATCH] org-capture.el: Allow `(here)' as a template target Tim Visher
@ 2023-05-12 16:35 ` Ihor Radchenko
0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-05-12 16:35 UTC (permalink / raw)
To: Tim Visher; +Cc: Emacs Org Mode mailing list
Tim Visher <tim.visher@gmail.com> writes:
> I think this should likely involve an update to the manual but I don't want
> to bother doing that unless the basic approach is approved.
LGTM.
We might also fix on the other side, not demanding (`car-safe') the target to be a list.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-12 16:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-12 15:35 [PATCH] org-capture.el: Allow `(here)' as a template target Tim Visher
2023-05-12 16:35 ` Ihor Radchenko
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).