1

Can yasnippet be used to insert an org subtree of the same level as the last? For example, if one often writes

***** $1
#+BEGIN_SRC latex
    \paragraph{$1.}
    $0
#+END_SRC

how might one avoid having to adjust the number of stars manually?

3

You can determine the current level within embedded Emacs-lisp code.

# -*- mode: snippet -*-
# name: org subtree
# key: ost
# --
`(make-string (org-current-level) ?*)` $1
#+BEGIN_SRC latex
    \paragraph{$1.}
    $0
#+END_SRC

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.