emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-capture %K "Link to the currently clocked task" link with id?
@ 2021-05-19 13:26 Nathaniel W Griswold
  2021-05-19 17:29 ` Nathaniel W Griswold
  0 siblings, 1 reply; 6+ messages in thread
From: Nathaniel W Griswold @ 2021-05-19 13:26 UTC (permalink / raw)
  To: emacs-orgmode

Looking at the source (org-capture.el), it appears org-capture doesn't allow you to make a permalink for "Link to the currently clocked task", or %K in your template.

`org-capture-fill-template` looks like this:

...
	 (v-K (if (marker-buffer org-clock-marker)
		  (org-link-make-string
		   (format "%s::*%s"
			   (buffer-file-name (marker-buffer org-clock-marker))
			   v-k)
		   v-k)
		""))
... 

So i guess it's hardcoded to just make a bracket link.

I guess i can hack something, but can you guys make a nice change to the source so that i can have a permalink to my clocked in task? Or is there something i'm missing and i can actually do it already?

Thank you

Nate

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

* Re: Org-capture %K "Link to the currently clocked task" link with id?
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Nathaniel W Griswold @ 2021-05-19 17:29 UTC (permalink / raw)
  To: emacs-orgmode

Rereading my message, i realized it might not be clear what i mean here.

I use (org-id-link-to-org-use-id t) because i like to be able to still follow links after i archive stuff. I want that behavior here so i want the link to an `id:<UUID>` link instead of a `file:/path/to/file` link.

Nate

> On May 19, 2021, at 8:26 AM, Nathaniel W Griswold <nate@manicmind.earth> wrote:
> 
> Looking at the source (org-capture.el), it appears org-capture doesn't allow you to make a permalink for "Link to the currently clocked task", or %K in your template.
> 
> `org-capture-fill-template` looks like this:
> 
> ...
> 	 (v-K (if (marker-buffer org-clock-marker)
> 		  (org-link-make-string
> 		   (format "%s::*%s"
> 			   (buffer-file-name (marker-buffer org-clock-marker))
> 			   v-k)
> 		   v-k)
> 		""))
> ... 
> 
> So i guess it's hardcoded to just make a bracket link.
> 
> I guess i can hack something, but can you guys make a nice change to the source so that i can have a permalink to my clocked in task? Or is there something i'm missing and i can actually do it already?
> 
> Thank you
> 
> Nate



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

* Org-capture %K "Link to the currently clocked task" link with id?
  2021-05-19 17:29 ` Nathaniel W Griswold
@ 2021-05-24 12:25   ` Nathaniel W Griswold
  2021-05-29  8:10     ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Nathaniel W Griswold @ 2021-05-24 12:25 UTC (permalink / raw)
  To: emacs-orgmode

> 
> On May 19, 2021, at 8:26 AM, Nathaniel W Griswold <nate@manicmind.earth> wrote:
> 
> Looking at the source (org-capture.el), it appears org-capture doesn't allow you to make a permalink for "Link to the currently clocked task", or %K in your template.
> 
> I use (org-id-link-to-org-use-id t) because i like to be able to still follow links after i archive stuff. I want that behavior here so i want the link to an `id:<UUID>` link instead of a `file:/path/to/file` link.


Would a patch for this be welcome? Does anyone have any suggestions or ideas? I was thinking it should just respect current value of `org-id-link-to-org-use-id` but maybe there should be something more specific?

Thanks!

Nate

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

* Re: Org-capture %K "Link to the currently clocked task" link with id?
  2021-05-24 12:25   ` Nathaniel W Griswold
@ 2021-05-29  8:10     ` Ihor Radchenko
       [not found]       ` <20231207185326.7937-1-kb@devnulllabs.io>
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2021-05-29  8:10 UTC (permalink / raw)
  To: Nathaniel W Griswold; +Cc: emacs-orgmode

Nathaniel W Griswold <nate@manicmind.earth> writes:
> Would a patch for this be welcome? Does anyone have any suggestions or ideas? I was thinking it should just respect current value of `org-id-link-to-org-use-id` but maybe there should be something more specific?

Sounds useful to me. Ideally, it would be even better to remove
hard-coded replacements in org-capture-fill-template and use some kind
of (?char . #'fill-function) alist to allow more flexibility.

Best,
Ihor


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

* Re: [PATCH] lisp/org-capture.el: use link ID's for %K
       [not found]       ` <20231207185326.7937-1-kb@devnulllabs.io>
@ 2023-12-08 13:56         ` Ihor Radchenko
       [not found]           ` <874jgsa5nh.fsf@devnulllabs.io>
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2023-12-08 13:56 UTC (permalink / raw)
  To: Kenny Ballou; +Cc: yantar92, emacs-orgmode

Kenny Ballou <kb@devnulllabs.io> writes:

> * org-capture.el (org-capture-fill-template): fill %K values using org
> ID's if `org-id-link-to-org-use-id' is non-nil.
> * doc/ORG-NEWS: (Template variable expansion %K) Document new behavior.

Thanks for the patch!

> +                  (if org-id-link-to-org-use-id
> +                      (org-link-make-string
> +                       (format "id:%s" (org-id-get org-clock-marker))
> +                       v-k)

`org-id-link-to-org-use-id' may have a number of non-nil values with
slightly different behaviour: t, create-if-interactive,
create-if-interactive-and-no-custom-id, use-existing, nil.

Your patch will only work as expected for t and nil values, but not for
others. You may consider leveraging `org-store-link' to account for all
the possibilities.

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

* Re: [PATCH] lisp/org-capture.el: use link ID's for %K
       [not found]           ` <874jgsa5nh.fsf@devnulllabs.io>
@ 2023-12-08 19:01             ` Ihor Radchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Ihor Radchenko @ 2023-12-08 19:01 UTC (permalink / raw)
  To: Kenny Ballou; +Cc: yantar92, emacs-orgmode

Kenny Ballou <kb@devnulllabs.io> writes:

> I'm currently struggling through modifying it to work with
> `org-store-link'.  Something, save-excursion -> org-clock-goto ->
> org-store-link -> org-insert-link is what I'm trying for now, but that's
> not quite working.  I'll come back to this in a few hours.

The last step is unnecessary. You may just examine `org-stored-links'
(documented in the docstring of `org-store-link') or
`org-store-link-plist' (undocumented, but containing more info and also
used by `org-capture-fill-template').

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

end of thread, other threads:[~2023-12-08 18:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
     [not found]       ` <20231207185326.7937-1-kb@devnulllabs.io>
2023-12-08 13:56         ` [PATCH] lisp/org-capture.el: use link ID's for %K Ihor Radchenko
     [not found]           ` <874jgsa5nh.fsf@devnulllabs.io>
2023-12-08 19:01             ` 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).