emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Matt Price <moptop99@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: insert default template when I create a new org buffer?
Date: Wed, 01 Jul 2015 19:07:04 -0400	[thread overview]
Message-ID: <87oajvh3zb.fsf@kyleam.com> (raw)
In-Reply-To: <87si97h4mn.fsf@kyleam.com> (Kyle Meyer's message of "Wed, 01 Jul 2015 18:53:04 -0400")

Kyle Meyer <kyle@kyleam.com> wrote:
> Matt Price <moptop99@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	other threads:[~2015-07-01 23:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01  0:40 insert default template when I create a new org buffer? Matt Price
2015-07-01  6:49 ` Eric S Fraga
2015-07-01 22:37   ` Matt Price
2015-07-01 22:53     ` Kyle Meyer
2015-07-01 23:07       ` Kyle Meyer [this message]
2015-07-02 14:30       ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oajvh3zb.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).