I want to append \n to specific easy-template

before 9.2 I could:

(setq org-structure-template-alist
      '(("s" "#+BEGIN_SRC ?\n\n#+END_SRC\n")
       ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE\n")
       ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE\n")
       ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE\n")
       ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM\n")))

the new value looks like this

Value: (("a" . "export ascii")
 ("c" . "center")
 ("C" . "comment")
 ("e" . "example")
 ("E" . "export")
 ("h" . "export html")
 ("l" . "export latex")
 ("q" . "quote")
 ("s" . "src")
 ("v" . "verse"))

more abstract but I can no longer do what I used to do.

any solution?

  • For specific patterns I now use yasnippet (github.com/joaotavora/yasnippet) which is very versatile. – Lgen Aug 31 '19 at 18:48
  • 1
    The new template mechanism already adds a newline at the end. Try C-c C-, s shell RET e.g. It also has the great advantage that it will wrap a block around a selected region. You can also load org-tempo and use the old <sTAB mechanism to insert a template and you can apparently use tempo templates to do more complicated things, but I have not felt the need to do so yet. – NickD Sep 1 '19 at 2:23
  • @NickD No, there is no extra \n added at the end. BTW wrap a block around a selected region is neat! never know this. – nichijou Sep 1 '19 at 6:12
  • 2
    You can use tempo-define-template, as I explained in this answer. – Omar Sep 1 '19 at 18:19
  • @nichijou: if you start with an empty buffer and do C-c C-, s shell RET and then do M-> to go to the end of the buffer, do you really end up at the end of the #+end_src line? Not at the line below it? BTW, there is no extra newline: just one newline at the end. – NickD Sep 2 '19 at 1:54

Your Answer

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

Browse other questions tagged or ask your own question.