Closed novoid closed 3 years ago
Hi! It may be doable, but I think it would requirie some changes on how snippets work internally. However I think your problem could be solved (but perhaps a bit less elegantly) by using src block snippets. I made a small tweak to make them respect the current indentation of the org-mode buffer when yanked. Here's an example:
** test:Test source block :src:
#+BEGIN_SRC org
,* My test
,** Level 2
I want to write something here $1
,** Level 2 again
Lorem ipsum.
,* Back to the root
$0
#+END_SRC
If you use this in your Yankpad file then you could go to the source block and press C-c '
(by default) and edit the snippet in a separate buffer, where you could expand headings etc.
Hi @Kungsgeten ,
I just installed yankpad-20210619.1756
which expand your example as expected.
Your workaround seems to be a clever one which actually might have some advantages as well such as limiting the search space to the headings of the current snippet instead of the while yankpad file. :+1:
Oh, one thing though: when my snippet already contains a SRC block, this trick does not work, right?
Reason: the first #+END_SRC
ends the snippet, not the corresponding SRC block within the snippet.
Update: I forgot that more characters may need escaping as explained in https://orgmode.org/manual/Literal-Examples.html#Literal-Examples
So the trick is to use ,#+BEGIN_SRC org
and ,#+END_SRC
in order to make it work.
Yes I think that org-mode
does the character escaping automatically if you edit using C-c '
. Happy to hear that you're still using Yankpad and that the suggested method works for you!
yankpad was and is one of my most important packages!
From the
README.org
:Have you thought about an option to get the ability to navigate through large snippets by collapsing and expanding sub-headings? This would make it much more easier to manage large and complex snippets from my perspective.
Thanks for your thoughts. Maybe you've already faced similar issues and found a way to deal with them.
Backround for my question
I do have some snippets that contain templates for larger projects, consisting of up to fifty headings with pre-defined dependencies among them using org-edna.
While yankpad gives me the advantage of being able to define snippets within org mode as major mode, the limitation of "no snippets with children" is some kind of a downer for managing large snippets. I usually locate a specific sub-heading by collapsing the headings and looking for the heading text of choice.
Related
For all readers that wonder how I'm able to have sub-headings within snippets: you may escape asterisks of sub-headings with a backslash within the snippet:
If somebody is interested in some thoughts on task dependencies (although not particular yankpad-related): Project management, from org-depend to org-edna, Dependencies, How to Define Projects.