[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] insert default template when I create a new org buffer?
From: |
Kyle Meyer |
Subject: |
Re: [O] insert default template when I create a new org buffer? |
Date: |
Wed, 01 Jul 2015 19:07:04 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Kyle Meyer <address@hidden> wrote:
> Matt Price <address@hidden> 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