Automatic templates for `Org-mode` files

What happened?

I’m having trouble getting a snippet to activate automatically on file creation. I’ve activated the file-templates module and added this line to my config.el:

(set-file-template! "\\.org$" :trigger "__" :mode 'org-mode)

and created a template in $DOOMDIR/snippets/org-mode/__ :

# -*- mode: snippet -*-
# name: temp
# --
#+latex_header: \usepackage{GlobalTemplate}

+file-templates/debug says it detects the snippet, but when I create a .org file, it still ends up empty.

What did you expect to happen?

I expected the snippet to activate and paste in:

#+latex_header: \usepackage{GlobalTemplate}

into any new org file I create.

Steps to reproduce

  1. Add set-file-template! line to config
  2. Create a new .org file with SPC f f
  3. No content is copied into the file.

System information


Loading data dump...
1 Like

The line #+latex_header: \usepackage{GlobalTemplate} starts with a #. If nothing is pasted, it probably means that the line is treated as a yasnippet comment. Does m i s __ insert something? If nothing is inserted try changing the line to \#+latex_header: \usepackage{GlobalTemplate}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.