Closed ag91 closed 3 years ago
Hi Andrea! I'm happy to hear that you enjoy Yankpad! ya-org-capture
seems nice for triggering snippets in an org-capture buffer. However I guess that the yankpad
category isn't set inside the capture buffer? I guess it could be set somehow in the capture template itself though.
Ah, good point. I tested it out and I see that yankpad-category
is bound to org-mode
. I think your mode smartly picks it up from the major mode in use.
It is a good point though, because I am implicitly restricting users to define their snippets only in the org-mode category.
Probably I will wait that a user (maybe myself :) opens a issue about this and I hope the hammock development approach will make brain produce a solution in the meanwhile.
I haven't seen that talk but I've added it to my watch list :) I think something like this could work:
(defun ya-org-capture/make-snippet (snippet-name &optional yp-category)
"Concatenate prefix to SNIPPET-NAME for substitution in `org-capture' flow.
Optionally set `yankpad-category' to YP-CATEGORY."
(if yp-category (yankpad-set-local-category yp-category))
(concatenate 'string ya-org-capture/ya-prefix snippet-name "\n"))
Hi,
Yankpad is great! I find out again and again how nice it is to keep snippets organized as org headings :+1:
I wanted to expand a snippet from within a org-capture template and I had to hack my way through. This is what I managed/wanted to achieve: https://github.com/ag91/ya-org-capture/blob/master/ya-org-capture-screehcast.gif I wanted to share this here if anybody else needs this in the future (and maybe somebody solved this more elegantly?). Here a more in detail explanation.
Hope this helps!
P.S.: I posted a similar message in a YASnippet issue to get more feedback. I really enjoy using all these projects and I'd love to have them work together in the most elegant way possible :D