emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kenny Ballou <kb@devnulllabs.io>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: yantar92@gmail.com, emacs-orgmode@gnu.org
Subject: Re: [PATCH] lisp/org-capture.el: use link ID's for %K
Date: Mon, 11 Dec 2023 08:33:26 -0700	[thread overview]
Message-ID: <87sf48922v.fsf@devnulllabs.io> (raw)
In-Reply-To: <87plzeqmgm.fsf@localhost>


On 2023-12-10 12:19 GMT, Ihor Radchenko wrote:
> Kenny Ballou <kb@devnulllabs.io> writes:
>
>>
>> I ended up using `org-store-link-plist'.  For some reason that I don't
>> understand, the `save-excursion' -> `org-store-link' was not updating
>> `org-stored-links'.
>
> I can see it from the code now. Basically, instead of updating
> `org-stored-links', `org-store-link' returns the link when called
> non-interactively (with nil INTERACTIVE? argument).
> Now documented on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=5e809903d

Thank you for this!

>
>> ... Similarly, I had to use `save-window-excursion' or
>> the `org-clock-goto' would really break things.
>
> You should not use `org-clock-goto' - it is intended for interactive use
> and does a lot of unnecessary work.
> You may instead do (org-with-point-at org-clock-marker ...)

Yes, it felt heavy handed, and I haven't quite figured out how to query
the current set of functions for desired functionality.  Thank you for
your patience in this process, I believe it has really simplified the
change and the resulting patch (to follow).

Using your suggestions, I believe we can simply grab the link from
`org-store-link' and use it (almost) directly as the value of %K.
Furthermore, we do not need to branch off `org-id-link-to-use-id'
because the correct behavior is captured by `org-store-link'.

My remaining question is whether I should use `current-prefix-arg' or
not?  I'm not sure if that would be surprising or not, or if it would
even get to `org-store-link' when doing a capture.

-- 
-Kenny


  reply	other threads:[~2023-12-11 15:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 13:26 Org-capture %K "Link to the currently clocked task" link with id? Nathaniel W Griswold
2021-05-19 17:29 ` Nathaniel W Griswold
2021-05-24 12:25   ` Nathaniel W Griswold
2021-05-29  8:10     ` Ihor Radchenko
2023-12-07 18:53       ` [PATCH] lisp/org-capture.el: use link ID's for %K Kenny Ballou
2023-12-08 13:56         ` Ihor Radchenko
2023-12-08 18:47           ` Kenny Ballou
2023-12-08 19:01             ` Ihor Radchenko
2023-12-09 22:53               ` Kenny Ballou
2023-12-10 12:19                 ` Ihor Radchenko
2023-12-11 15:33                   ` Kenny Ballou [this message]
2023-12-11 15:46                   ` Kenny Ballou
     [not found]                   ` <20231211154357.23020-1-kb@devnulllabs.io>
     [not found]                     ` <87ttoo7dna.fsf@localhost>
2023-12-11 21:21                       ` Kenny Ballou
2023-12-12  4:13                         ` [PATCH] lisp/org-capture.el: use `org-store-link' for %K values Kenny Ballou
2023-12-12  4:32                           ` Kenny Ballou
2023-12-12  4:32                             ` [PATCH] lisp/org-capture.el: use `org-store-link' for %K values Kenny Ballou
2023-12-12 12:46                               ` Ihor Radchenko

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=87sf48922v.fsf@devnulllabs.io \
    --to=kb@devnulllabs.io \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    --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).