emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* autoinsert
@ 2018-06-07 17:16 Joseph Vidal-Rosset
  2018-06-07 21:06 ` autoinsert Nick Dokos
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph Vidal-Rosset @ 2018-06-07 17:16 UTC (permalink / raw)
  To: emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 886 bytes --]

Hello,

To get an .org file with my .bib links I'm using this code in my user.el
(i.e. init.el):

 #+BEGIN_SRC 
 (require 'autoinsert)
(push '(org-mode . "/home/joseph/MEGA/org/orgskeleton.org") auto-insert-alist)
(add-hook 'find-file-hook 'auto-insert)
 #+END_SRC


in this orgskeleton.org there is only these links:

[[bibliography:/home/joseph/MEGA/org/reforg.bib]]
[[bibliographystyle:apalike]] 

Now, I  would be happy  to define  a beamerskeleton.org into  a beamer
directory, a article-skeleton.org ino a papers directory and so on, 
in  order to  get default  files for  beamer presentations, papers,  and so
on.  Reading autoinsert.el,  I guess  that it  is possible,  but I  am
really to  bad in lisp to  get the right code  to autoinsert different
skeletons when I open a new file in different directories. 

I need help, and in advance, many thanks. 

Best wishes, 

-- 
Jo.

[-- Attachment #2.1: Type: text/html, Size: 1060 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoinsert
  2018-06-07 17:16 autoinsert Joseph Vidal-Rosset
@ 2018-06-07 21:06 ` Nick Dokos
  2018-06-08  7:12   ` autoinsert Joseph Vidal-Rosset
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2018-06-07 21:06 UTC (permalink / raw)
  To: emacs-orgmode

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> Hello,
>
> To get an .org file with my .bib links I’m using this code in my user.el
> (i.e. init.el):
>
>  (require 'autoinsert)
> (push '(org-mode . "/home/joseph/MEGA/org/orgskeleton.org") auto-insert-alist)
> (add-hook 'find-file-hook 'auto-insert)
>
> in this orgskeleton.org there is only these links:
>
> /home/joseph/MEGA/org/reforg.bib
>
> Now, I would be happy to define a beamerskeleton.org into a beamer
> directory, a article-skeleton.org ino a papers directory and so on,
> in order to get default files for beamer presentations, papers, and so
> on. Reading autoinsert.el, I guess that it is possible, but I am
> really to bad in lisp to get the right code to autoinsert different
> skeletons when I open a new file in different directories.
>

I'm not sure I understand the problem.

Are you producing the beamer presentations, the papers, etc. from org
files? If so, isn't the org-mode insertion enough? If not, why not?
 
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoinsert
  2018-06-07 21:06 ` autoinsert Nick Dokos
@ 2018-06-08  7:12   ` Joseph Vidal-Rosset
  2018-06-08  7:32     ` autoinsert Joseph Vidal-Rosset
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph Vidal-Rosset @ 2018-06-08  7:12 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1366 bytes --]

Le jeu. 07 juin 2018 à 05:06:20 , Nick Dokos <ndokos@gmail.com> a envoyé
ce message:

#+BEGIN_QUOTE
> Are you producing the beamer presentations, the papers, etc. from org
> files? If so, isn't the org-mode insertion enough? If not, why not?
#+END_QUOTE

Many thanks for your question. Yes, I am now always using org-mode for
my beamer presentations and my  papers. But the org-mode templates for
beamer presentations are of course  different from papers's and I want
to define different skeletons.org to  auto-insert according the fact I
am writing a new file in such or such directory. 

Suppose that, for example, I am writing a new beamer presentation, say
new-beamer-talk.org in /home/joseph/MEGA/org/beamer/, it would be nice
to get  auto-insertion of my  org template for my  beamer presentation
via a beamer-skeleton.org,  and the same thing for  a new-paper.org if
that I  want to register in  /home/joseph/MEGA/org/papers/, getting an
auto-insertion of  paper-skeleton.org for  this new-paper.org,  and so
on. I suppose that  it is possible, and even that it  is quite easy to
get it, but I do not know how to code it. 

At the moment, I am reading [[https://www.emacswiki.org/emacs/AutoInsertMode]]
and [[https://www.emacswiki.org/emacs/SkeletonMode]]
to find the solution. 

Help is always welcome.

 Best wishes,
-- 
Jo.

[-- Attachment #2.1: Type: text/html, Size: 1835 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoinsert
  2018-06-08  7:12   ` autoinsert Joseph Vidal-Rosset
@ 2018-06-08  7:32     ` Joseph Vidal-Rosset
  2018-06-08  7:38       ` autoinsert Joseph Vidal-Rosset
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph Vidal-Rosset @ 2018-06-08  7:32 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

Hello,

A  solution   to  my  problem  was   indeed  given  in  this   web  page
[[https://www.emacswiki.org/emacs/AutoInsertMode]]:


#+BEGIN_SRC 
#+BEGIN_QUOTE
(auto-insert-mode)  ;;; Adds hook to find-files-hook
    (setq auto-insert-directory "~/.mytemplates/") ;;; Or use custom, *NOTE* Trailing slash important
    (setq auto-insert-query nil) ;;; If you don't want to be prompted before insertion
    (define-auto-insert "\.py" "my-python-template.py")
    (define-auto-insert "\.php" "my-php-template.php")
#+END_SRC

It should not be too difficult, even for me, to adapt this code that I
just tested.

 Best wishes,
-- 
Jo.

[-- Attachment #2.1: Type: text/html, Size: 778 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoinsert
  2018-06-08  7:32     ` autoinsert Joseph Vidal-Rosset
@ 2018-06-08  7:38       ` Joseph Vidal-Rosset
  2018-06-08  8:37         ` autoinsert Joseph Vidal-Rosset
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph Vidal-Rosset @ 2018-06-08  7:38 UTC (permalink / raw)
  To: Nick Dokos; +Cc: Liste-emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]

obvious correction:

(auto-insert-mode)  ;;; Adds hook to find-files-hook
    (setq auto-insert-directory "~/.mytemplates/") ;;; Or use custom,
*NOTE* Trailing slash important
    (setq auto-insert-query nil) ;;; If you don't want to be prompted
before insertion
    (define-auto-insert "\.py" "my-python-template.py")
    (define-auto-insert "\.php" "my-php-template.php")


the "#+BEGIN_QUOTE " did not belong to the code that I wanted to quote.

2018-06-08 9:32 GMT+02:00 Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com
>:

> Hello,
>
> A solution to my problem was indeed given in this web page
> https://www.emacswiki.org/emacs/AutoInsertMode:
>
> #+BEGIN_QUOTE
> (auto-insert-mode)  ;;; Adds hook to find-files-hook
>     (setq auto-insert-directory "~/.mytemplates/") ;;; Or use custom, *NOTE* Trailing slash important
>     (setq auto-insert-query nil) ;;; If you don't want to be prompted before insertion
>     (define-auto-insert "\.py" "my-python-template.py")
>     (define-auto-insert "\.php" "my-php-template.php")
>
> It should not be too difficult, even for me, to adapt this code that I
> just tested.
>
> Best wishes,
> –
> Jo.
>

[-- Attachment #2: Type: text/html, Size: 2060 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoinsert
  2018-06-08  7:38       ` autoinsert Joseph Vidal-Rosset
@ 2018-06-08  8:37         ` Joseph Vidal-Rosset
  2018-06-09  9:57           ` autoinsert Eric S Fraga
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph Vidal-Rosset @ 2018-06-08  8:37 UTC (permalink / raw)
  Cc: Liste-emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

Hello,

Here is the  adaptation of the previous  lines of code that  works in my
setup (the web page [[https://www.emacswiki.org/emacs/RegularExpression]] was helpful): 

#+BEGIN_SRC 
(require 'autoinsert)
(auto-insert-mode)  ;;; Adds hook to find-files-hook
    (setq auto-insert-directory "~/MEGA/org/my_org-templates/") ;;; Or use custom, *NOTE* Trailing slash important
    (setq auto-insert-query nil) ;;; If you don't want to be prompted before insertion
    (define-auto-insert "\.beamer-fr.org" "my-beamer-fr.org")
#+END_SRC

Now, supposing that I have to give a talk in French at Aix-en-Provence (very nice
city!), when I open in emacs  the new file aix-beamer-fr.org this file
automatically contains  the lines defined in  my-beamer-fr.org that is
in ~/MEGA/org/my_org-templates/ . 

That is  certainly trivial  for a lot  of people in  this list  (and I
apologize), but maybe it will be helpful for others. 


 Best wishes,
-- 
Jo.

[-- Attachment #2.1: Type: text/html, Size: 1121 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: autoinsert
  2018-06-08  8:37         ` autoinsert Joseph Vidal-Rosset
@ 2018-06-09  9:57           ` Eric S Fraga
  0 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2018-06-09  9:57 UTC (permalink / raw)
  To: Joseph Vidal-Rosset; +Cc: Liste-emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

On Friday,  8 Jun 2018 at 10:37, Joseph Vidal-Rosset wrote:

[...]

> That is certainly trivial for a lot of people in this list (and I
> apologize), but maybe it will be helpful for others.

Thanks for this.  I had the same query but had not got around to seeing
if it was possible.  Saved me some time!

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-09  9:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-07 17:16 autoinsert Joseph Vidal-Rosset
2018-06-07 21:06 ` autoinsert Nick Dokos
2018-06-08  7:12   ` autoinsert Joseph Vidal-Rosset
2018-06-08  7:32     ` autoinsert Joseph Vidal-Rosset
2018-06-08  7:38       ` autoinsert Joseph Vidal-Rosset
2018-06-08  8:37         ` autoinsert Joseph Vidal-Rosset
2018-06-09  9:57           ` autoinsert 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).