From: Tim Visher <tim.visher@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Emacs Org Mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] org-capture.el: Allow `(here)' as a template target
Date: Tue, 20 Jun 2023 15:32:02 -0400 [thread overview]
Message-ID: <CAHa53uz5ibrXXF47aUTy_N=km2E-n4Ob37Jub4S4eU=L4SxgkQ@mail.gmail.com> (raw)
In-Reply-To: <87mt29zevs.fsf@localhost>
[-- Attachment #1.1: Type: text/plain, Size: 430 bytes --]
On Fri, May 12, 2023 at 12:32 PM Ihor Radchenko <yantar92@posteo.net> wrote:
> 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.
>
Sorry this took me forever to get to.
I've now created patches for updating the manual and NEWS file. Let me know
how they look!
[-- Attachment #1.2: Type: text/html, Size: 853 bytes --]
[-- Attachment #2: 0001-org-capture.el-Allow-here-as-a-template-target 2.patch --]
[-- Type: application/octet-stream, Size: 1658 bytes --]
From 16fa8be795f61822252a20f871a62114fe84c8fe 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 1/3] 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 #3: 0003-etc-ORG-NEWS-Add-entry-for-here-capture-template-tar.patch --]
[-- Type: application/octet-stream, Size: 910 bytes --]
From 419d7d40e8cd890613ecffa686142441840c7be6 Mon Sep 17 00:00:00 2001
From: Tim Visher <tim.visher@gmail.com>
Date: Tue, 20 Jun 2023 15:12:47 -0400
Subject: [PATCH 3/3] etc/ORG-NEWS: Add entry for `(here)` capture template
target support
---
etc/ORG-NEWS | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a24caddfe..3201918eb 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -294,6 +294,11 @@ skipped (with a warning) if the ox-icalendar export encounters them:
Also note that only vanilla repeaters are currently exported; the
special repeaters ~++~ and ~.+~ are skipped.
+*** Capture templates now support ~(here)~ as a target
+
+A capture template can target ~(here)~ which is the equivalent of
+invoking a capture template with a zero prefix.
+
** Miscellaneous
*** =org-crypt.el= now applies initial visibility settings to decrypted entries
--
2.40.1
[-- Attachment #4: 0002-doc-org-manual.org-Add-documentation-for-here-target.patch --]
[-- Type: application/octet-stream, Size: 768 bytes --]
From 73a7f8b9fba855080ce27b8d508e6503cdf42181 Mon Sep 17 00:00:00 2001
From: Tim Visher <tim.visher@gmail.com>
Date: Tue, 20 Jun 2023 15:11:58 -0400
Subject: [PATCH 2/3] doc/org-manual.org: Add documentation for `(here)` target
---
doc/org-manual.org | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 4feb15e71..5c0041ef0 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -7946,6 +7946,10 @@ Now lets look at the elements of a template definition. Each entry in
File to the entry that is currently being clocked.
+ - =(here)= ::
+
+ The position of =point=.
+
- =(function function-finding-location)= ::
Most general way: write your own function which both visits the
--
2.40.1
next prev parent reply other threads:[~2023-06-20 19:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 15:35 [PATCH] org-capture.el: Allow `(here)' as a template target Tim Visher
2023-05-12 16:35 ` Ihor Radchenko
2023-06-20 19:32 ` Tim Visher [this message]
2023-06-21 10:33 ` Ihor Radchenko
2023-06-21 13:12 ` Tim Visher
2023-06-21 15:59 ` Ihor Radchenko
2023-06-21 18:30 ` Tim Visher
2023-06-22 10:18 ` Ihor Radchenko
2023-06-22 13:53 ` Tim Visher
2023-06-23 10:58 ` Ihor Radchenko
2023-06-23 12:02 ` Tim Visher
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='CAHa53uz5ibrXXF47aUTy_N=km2E-n4Ob37Jub4S4eU=L4SxgkQ@mail.gmail.com' \
--to=tim.visher@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/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).