From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: insert default template when I create a new org buffer? Date: Wed, 01 Jul 2015 19:07:04 -0400 Message-ID: <87oajvh3zb.fsf@kyleam.com> References: <877fqk1ieo.fsf@ucl.ac.uk> <87si97h4mn.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAR60-0002cB-Jj for emacs-orgmode@gnu.org; Wed, 01 Jul 2015 19:07:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAR5v-0007Ky-GD for emacs-orgmode@gnu.org; Wed, 01 Jul 2015 19:07:12 -0400 Received: from mail-qk0-f169.google.com ([209.85.220.169]:35125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAR5v-0007KB-CT for emacs-orgmode@gnu.org; Wed, 01 Jul 2015 19:07:07 -0400 Received: by qkbp125 with SMTP id p125so40738418qkb.2 for ; Wed, 01 Jul 2015 16:07:05 -0700 (PDT) In-Reply-To: <87si97h4mn.fsf@kyleam.com> (Kyle Meyer's message of "Wed, 01 Jul 2015 18:53:04 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Matt Price Cc: Org Mode Kyle Meyer wrote: > Matt Price 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