emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org bea9fca183 2/2: org-capture.el: Allow `(here)' as a


From: ELPA Syncer
Subject: [elpa] externals/org bea9fca183 2/2: org-capture.el: Allow `(here)' as a template target
Date: Thu, 22 Jun 2023 06:58:22 -0400 (EDT)

branch: externals/org
commit bea9fca183d3f8f7664f68a6a36b8778e9b53e2a
Author: Tim Visher <tim.visher@gmail.com>
Commit: Ihor Radchenko <yantar92@posteo.net>

    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'.
    (org-capture-templates): Update the docstring, describing the new
    target.
    * doc/org-manual.org (Template elements): Add `(here)' target
    documentation
    * etc/ORG-NEWS (Capture templates now support ~(here)~ as a target):
    Document the new feature.
    
    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
---
 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 21582fe8ee..76131f1102 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 94efa8fa80..01d2975d32 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 d4311dd20a..40a7f78f17 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]