1

I know that we can customize the source code expansion <s TAB using something like this

(add-to-list 'org-structure-template-alist '("s" "#+BEGIN_SRC ? :results raw replace drawer hline: yes\n\n#+END_SRC"))

This would expand into something like this:

#+BEGIN_SRC <my cursor here>  :results raw replace drawer hline: yes

#+END_SRC

My cursor would be at the <my cursor here> so I can write name of the source code, e.g C, Python, bash...etc.

I would like to add another "jump point" so I can have something like this:

#+BEGIN_SRC <my cursor here>  :results raw replace drawer hline: yes
<next cursor here>
#+END_SRC

So, I can TAB after typing the type of the code and start writing right away. Is it possible to do this? I tried to add a second ? but it doesnt work.

(add-to-list 'org-structure-template-alist '("s" "#+BEGIN_SRC ? :results raw replace drawer hline: yes\n?\n#+END_SRC"))

This is what I got after adding a second ?.

#+BEGIN_SRC ?  :results raw replace drawer hline: yes
<cursor is here>
#+END_SRC

So, the first ? is skipped entirely.

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.