Kyle Meyer <k...@kyleam.com> wrote:
> Matt Price <mopto...@gmail.com> wrote:
>> I have the notion I should be able to have emacs just insert the
>> template for me when the buffer is created.  Maybe what I need is
>> "auto-insert-mode" but I can't quite figure out how to have it run a
>> function.  Was hoping someone else had figured it out already!
>
> Perhaps you could add it to find-file-hook (not tested):
>
> #+begin_src elisp
>   (defun org-export-insert-latex-template ()
>     (when (and (derived-mode-p 'org-mode)
>                (and (bobp) (eobp)))
>       (org-export-insert-default-template 'latex)))
>
>   (add-hook 'find-file-hook #'org-export-insert-latex-template)
> #+end_src

I take that back: that's probably not a good hook to add it to because
anywhere find-file is called in the Org code could trigger it.  But
maybe there is another, more suitable hook you could use.

-- 
Kyle

Reply via email to