* insert default template when I create a new org buffer?
@ 2015-07-01 0:40 Matt Price
2015-07-01 6:49 ` Eric S Fraga
0 siblings, 1 reply; 6+ messages in thread
From: Matt Price @ 2015-07-01 0:40 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1: Type: text/plain, Size: 289 bytes --]
Hi folks,
I seem to remember, years ago, that when I created new org buffers the
default export template whould be inserted at the top of the file
automatically. Now I can't remember how I made that happen. Is thre a
really simple way to od this that I've just forgotten? Thanks,
Matt
[-- Attachment #2: Type: text/html, Size: 357 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: insert default template when I create a new org buffer?
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
0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2015-07-01 6:49 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode
On Tuesday, 30 Jun 2015 at 20:40, Matt Price wrote:
> Hi folks,
>
> I seem to remember, years ago, that when I created new org buffers the
> default export template whould be inserted at the top of the file
> automatically. Now I can't remember how I made that happen. Is thre a
> really simple way to od this that I've just forgotten? Thanks,
> Matt
M-x org-export-insert-default-template RET
and then choose which version as there are specific templates for
different export targets.
--
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1260-gcedef7
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: insert default template when I create a new org buffer?
2015-07-01 6:49 ` Eric S Fraga
@ 2015-07-01 22:37 ` Matt Price
2015-07-01 22:53 ` Kyle Meyer
0 siblings, 1 reply; 6+ messages in thread
From: Matt Price @ 2015-07-01 22:37 UTC (permalink / raw)
To: Matt Price, Org Mode
[-- Attachment #1: Type: text/plain, Size: 963 bytes --]
On Wed, Jul 1, 2015 at 2:49 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> On Tuesday, 30 Jun 2015 at 20:40, Matt Price wrote:
> > Hi folks,
> >
> > I seem to remember, years ago, that when I created new org buffers the
> > default export template whould be inserted at the top of the file
> > automatically. Now I can't remember how I made that happen. Is thre a
> > really simple way to od this that I've just forgotten? Thanks,
> > Matt
>
> M-x org-export-insert-default-template RET
>
> and then choose which version as there are specific templates for
> different export targets.
>
Thanks Eric. 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!
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org
> release_8.3beta-1260-gcedef7
>
[-- Attachment #2: Type: text/html, Size: 1610 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: insert default template when I create a new org buffer?
2015-07-01 22:37 ` Matt Price
@ 2015-07-01 22:53 ` Kyle Meyer
2015-07-01 23:07 ` Kyle Meyer
2015-07-02 14:30 ` Eric S Fraga
0 siblings, 2 replies; 6+ messages in thread
From: Kyle Meyer @ 2015-07-01 22:53 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode
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
--
Kyle
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: insert default template when I create a new org buffer?
2015-07-01 22:53 ` Kyle Meyer
@ 2015-07-01 23:07 ` Kyle Meyer
2015-07-02 14:30 ` Eric S Fraga
1 sibling, 0 replies; 6+ messages in thread
From: Kyle Meyer @ 2015-07-01 23:07 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: insert default template when I create a new org buffer?
2015-07-01 22:53 ` Kyle Meyer
2015-07-01 23:07 ` Kyle Meyer
@ 2015-07-02 14:30 ` Eric S Fraga
1 sibling, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2015-07-02 14:30 UTC (permalink / raw)
To: Kyle Meyer; +Cc: Org Mode
On Wednesday, 1 Jul 2015 at 18:53, Kyle Meyer wrote:
[...]
> Perhaps you could add it to find-file-hook (not tested):
or
,----[ C-h v find-file-not-found-functions RET ]
| find-file-not-found-functions is a variable defined in `files.el'.
| Its value is nil
|
| This variable may be risky if used as a file-local variable.
|
| Documentation:
| List of functions to be called for `find-file' on nonexistent file.
| These functions are called as soon as the error is detected.
| Variable `buffer-file-name' is already set up.
| The functions are called in the order given until one of them returns non-nil.
|
| [back]
`----
--
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-1216-gb856f6.dirty
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-02 14:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-07-02 14:30 ` Eric S Fraga
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).