emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [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; 11+ 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] 11+ 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
  2023-06-20 19:32   ` Tim Visher
  0 siblings, 1 reply; 11+ 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] 11+ messages in thread

* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
  2023-05-12 16:35 ` Ihor Radchenko
@ 2023-06-20 19:32   ` Tim Visher
  2023-06-21 10:33     ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Tim Visher @ 2023-06-20 19:32 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org Mode mailing list


[-- 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
  2023-06-20 19:32   ` Tim Visher
@ 2023-06-21 10:33     ` Ihor Radchenko
  2023-06-21 13:12       ` Tim Visher
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-06-21 10:33 UTC (permalink / raw)
  To: Tim Visher; +Cc: Emacs Org Mode mailing list

Tim Visher <tim.visher@gmail.com> writes:

> 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!

Thanks! The patches look good, and the commit messages look excellent.
You could, however, squash the patches together - they are about the
same change; there is no good reason to separate them.

Also, may you update the docstring of `org-capture-templates' and
"10.1.3.1 Template elements" section of Org manual?

-- 
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] 11+ messages in thread

* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
  2023-06-21 10:33     ` Ihor Radchenko
@ 2023-06-21 13:12       ` Tim Visher
  2023-06-21 15:59         ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Tim Visher @ 2023-06-21 13:12 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org Mode mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1784 bytes --]

On Wed, Jun 21, 2023 at 6:29 AM Ihor Radchenko <yantar92@posteo.net> wrote:

> Tim Visher <tim.visher@gmail.com> writes:
>
> > I've now created patches for updating the manual and NEWS file. Let me
> know
> > how they look!
>
> Thanks! The patches look good, and the commit messages look excellent.
>

٩( ᐛ )و


> You could, however, squash the patches together


Absolutely! Will do once we've approved the whole change. I will use the
commit message of 0001 for the whole patch.


> Also, may you update the docstring of `org-capture-templates'


Good catch! This has been done in patch 0004 now. Look good?


> "10.1.3.1 Template elements" section of Org manual?
>

I'm confused about what you're referring to here. Isn't that what 0002 does?

```
$ cat 0002-squash-doc-org-manual.org-Add-documentation-for-here.patch
From 4b4bf944129635637c6fd57076f1c963b4c27bf6 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/4] squash! 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 21582fe8e..76131f110 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
```

Again, happy to squash and provide a single complete patch once we're all
done the review. Thanks again, Ihor! :)

[-- Attachment #1.2: Type: text/html, Size: 3072 bytes --]

[-- Attachment #2: 0002-squash-doc-org-manual.org-Add-documentation-for-here.patch --]
[-- Type: application/octet-stream, Size: 777 bytes --]

From 4b4bf944129635637c6fd57076f1c963b4c27bf6 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/4] squash! 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 21582fe8e..76131f110 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


[-- Attachment #3: 0003-squash-etc-ORG-NEWS-Add-entry-for-here-capture-templ.patch --]
[-- Type: application/octet-stream, Size: 918 bytes --]

From bcd78dcc5805e578ed7d4b47704f7c271d88d76f 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/4] squash! 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: 0004-squash-Update-docstring-of-org-capture-templates.patch --]
[-- Type: application/octet-stream, Size: 878 bytes --]

From 2aebb9e2d41fbad080d9b8a84c2a885af7233686 Mon Sep 17 00:00:00 2001
From: Tim Visher <tim.visher@gmail.com>
Date: Wed, 21 Jun 2023 09:05:38 -0400
Subject: [PATCH 4/4] squash! Update docstring of org-capture-templates

---
 lisp/org-capture.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index f14e95c5c..40a7f78f1 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -220,6 +220,9 @@ target       Specification of where the captured item should be placed.
              (clock)
                 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 file and moves point to the right location
-- 
2.40.1


[-- Attachment #5: 0001-org-capture.el-Allow-here-as-a-template-target 2.patch --]
[-- Type: application/octet-stream, Size: 1658 bytes --]

From 184098a426495d80c12fc7fa90218681a5bb1f0f 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/4] 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] 11+ messages in thread

* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
  2023-06-21 13:12       ` Tim Visher
@ 2023-06-21 15:59         ` Ihor Radchenko
  2023-06-21 18:30           ` Tim Visher
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-06-21 15:59 UTC (permalink / raw)
  To: Tim Visher; +Cc: Emacs Org Mode mailing list

Tim Visher <tim.visher@gmail.com> writes:

>> Also, may you update the docstring of `org-capture-templates'
>
>
> Good catch! This has been done in patch 0004 now. Look good?

Yup.

>> "10.1.3.1 Template elements" section of Org manual?
>
> I'm confused about what you're referring to here. Isn't that what 0002 does?

Yes, it does. I saw it, then noticed the missing `org-capture-templates'
docstring update, and somehow deduced that manual must be missing :facepalm:

> Again, happy to squash and provide a single complete patch once we're all
> done the review. Thanks again, Ihor! :)

Please, also add all the necessary changelog entries to the final commit
message.

-- 
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] 11+ messages in thread

* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
  2023-06-21 15:59         ` Ihor Radchenko
@ 2023-06-21 18:30           ` Tim Visher
  2023-06-22 10:18             ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Tim Visher @ 2023-06-21 18:30 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org Mode mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1323 bytes --]

On Wed, Jun 21, 2023 at 11:54 AM Ihor Radchenko <yantar92@posteo.net> wrote:

> Tim Visher <tim.visher@gmail.com> writes:
>
> >> Also, may you update the docstring of `org-capture-templates'
> >
> >
> > Good catch! This has been done in patch 0004 now. Look good?
>
> Yup.
>

👍

>> "10.1.3.1 Template elements" section of Org manual?
> >
> > I'm confused about what you're referring to here. Isn't that what 0002
> does?
>
> Yes, it does. I saw it, then noticed the missing `org-capture-templates'
> docstring update, and somehow deduced that manual must be missing
> :facepalm:
>

👍


> > Again, happy to squash and provide a single complete patch once we're all
> > done the review. Thanks again, Ihor! :)
>
> Please, also add all the necessary changelog entries to the final commit
> message.
>

Will do! I've attached a prospective patch file but I'm not sure I follow
what you mean by 'add all the necessary changelog entries to the final
commit
message'. Looking at this commit
<https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=294a4d2fe21ffcdc1acbbafed1bfc69a1ece7d13>
I'm guessing that I should have an `* …` entry for every file except
`etc/NEWS` that I changed so I've done that but please do let me know if
that was the wrong interpretation. :)

[-- Attachment #1.2: Type: text/html, Size: 2149 bytes --]

[-- Attachment #2: 0001-org-capture.el-Allow-here-as-a-template-target 3.patch --]
[-- Type: application/octet-stream, Size: 3288 bytes --]

From 42fb53de48e51639cfd6fc9cc5a24bde051f24e5 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.
* doc/org-manual.org (Template elements): Add `(here)' target
documentation

TINYCHANGE
---
 doc/org-manual.org  | 4 ++++
 etc/ORG-NEWS        | 5 +++++
 lisp/org-capture.el | 6 +++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 21582fe8e..76131f110 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
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 94efa8fa8..01d2975d3 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -303,6 +303,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
 
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index d4311dd20..40a7f78f1 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -220,6 +220,9 @@ target       Specification of where the captured item should be placed.
              (clock)
                 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 file and moves point to the right location
@@ -991,7 +994,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] 11+ messages in thread

* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
  2023-06-21 18:30           ` Tim Visher
@ 2023-06-22 10:18             ` Ihor Radchenko
  2023-06-22 13:53               ` Tim Visher
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-06-22 10:18 UTC (permalink / raw)
  To: Tim Visher; +Cc: Emacs Org Mode mailing list

Tim Visher <tim.visher@gmail.com> writes:

> Will do! I've attached a prospective patch file but I'm not sure I follow
> what you mean by 'add all the necessary changelog entries to the final
> commit
> message'. Looking at this commit
> <https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=294a4d2fe21ffcdc1acbbafed1bfc69a1ece7d13>
> I'm guessing that I should have an `* …` entry for every file except
> `etc/NEWS` that I changed so I've done that but please do let me know if
> that was the wrong interpretation. :)

Applied, onto main, amending the changelog entries.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=bea9fca18

Should be an entry for every file, including ORG-NEWS, followed by more
general comments.

-- 
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] 11+ messages in thread

* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
  2023-06-22 10:18             ` Ihor Radchenko
@ 2023-06-22 13:53               ` Tim Visher
  2023-06-23 10:58                 ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Tim Visher @ 2023-06-22 13:53 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org Mode mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1061 bytes --]

On Thu, Jun 22, 2023 at 6:13 AM Ihor Radchenko <yantar92@posteo.net> wrote:

> Tim Visher <tim.visher@gmail.com> writes:
>
> > Will do! I've attached a prospective patch file but I'm not sure I follow
> > what you mean by 'add all the necessary changelog entries to the final
> > commit
> > message'. Looking at this commit
> > <
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=294a4d2fe21ffcdc1acbbafed1bfc69a1ece7d13
> >
> > I'm guessing that I should have an `* …` entry for every file except
> > `etc/NEWS` that I changed so I've done that but please do let me know if
> > that was the wrong interpretation. :)
>
> Applied, onto main, amending the changelog entries.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=bea9fca18
>
> Should be an entry for every file, including ORG-NEWS, followed by more
> general comments.
>

🤜 🤛 !!! :)

I've attached a small follow up `worg` patch to hopefully clarify the
changelog section of the commit message going forward for other
contributors.

[-- Attachment #1.2: Type: text/html, Size: 1816 bytes --]

[-- Attachment #2: 0001-org-contribute.org-Clarify-files-to-include-in-chang.patch --]
[-- Type: application/octet-stream, Size: 1371 bytes --]

From 54726ecbf000c6d2bbf1667df5bda98362121f45 Mon Sep 17 00:00:00 2001
From: Tim Visher <tim.visher@gmail.com>
Date: Thu, 22 Jun 2023 09:47:52 -0400
Subject: [PATCH] org-contribute.org: Clarify files to include in changelog
 section

* org-contribute.org (What's in a commit message?): Clarify that /all/
files should be included in the changelog section of the commit
message, including `org-manual.org' and `ORG-NEWS'.

TINYCHANGE
---
 org-contribute.org | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/org-contribute.org b/org-contribute.org
index bab9e798..0f17df32 100644
--- a/org-contribute.org
+++ b/org-contribute.org
@@ -303,6 +303,12 @@ A commit message should be constructed in the following way:
   : property as the default timer value.  Three prefix arguments will
   : ignore the Effort value property.
 
+  *Note:* There should be an entry for /every/ file changed in the
+  commit. This includes, for instance, =etc/ORG-NEWS= and
+  =doc/org-manual.org= if your change was relevant there. [[https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=bea9fca18][This]] is a
+  good example of a =TINYCHANGE= that also touched the manual and news
+  files.
+
 - After the ChangeLog entry, another empty line should come before any
   additional information that the committer wishes to provide in order
   to explain the patch.
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
  2023-06-22 13:53               ` Tim Visher
@ 2023-06-23 10:58                 ` Ihor Radchenko
  2023-06-23 12:02                   ` Tim Visher
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2023-06-23 10:58 UTC (permalink / raw)
  To: Tim Visher; +Cc: Emacs Org Mode mailing list

Tim Visher <tim.visher@gmail.com> writes:

> I've attached a small follow up `worg` patch to hopefully clarify the
> changelog section of the commit message going forward for other
> contributors.

Thanks!
Applied, onto master, with amendments:

1. I removed "Note", converting into normal sentence. Note is redundant.
2. I added reference to GNU standards, explaining what ChangeLogs are.
https://git.sr.ht/~bzg/worg/commit/ac865c20

-- 
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] 11+ messages in thread

* Re: [PATCH] org-capture.el: Allow `(here)' as a template target
  2023-06-23 10:58                 ` Ihor Radchenko
@ 2023-06-23 12:02                   ` Tim Visher
  0 siblings, 0 replies; 11+ messages in thread
From: Tim Visher @ 2023-06-23 12:02 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org Mode mailing list

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

On Fri, Jun 23, 2023 at 6:53 AM Ihor Radchenko <yantar92@posteo.net> wrote:

> Tim Visher <tim.visher@gmail.com> writes:
>
> > I've attached a small follow up `worg` patch to hopefully clarify the
> > changelog section of the commit message going forward for other
> > contributors.
>
> Thanks!
> Applied, onto master, with amendments:
>
> 1. I removed "Note", converting into normal sentence. Note is redundant.
> 2. I added reference to GNU standards, explaining what ChangeLogs are.
> https://git.sr.ht/~bzg/worg/commit/ac865c20


Fantastic! Thanks for all your help, Ihor! TTFN!

[-- Attachment #2: Type: text/html, Size: 1119 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-06-23 12:04 UTC | newest]

Thread overview: 11+ 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
2023-06-20 19:32   ` Tim Visher
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

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