From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joseph Vidal-Rosset Subject: Re: autoinsert Date: Fri, 08 Jun 2018 10:37:01 +0200 Message-ID: <871sdhhdxu.fsf@gmail.com> References: <87muw6ldp5.fsf@gmail.com> <87k1rab92r.fsf@alphaville.usersys.redhat.com> <87a7s5wy47.fsf@gmail.com> <87r2lhn36h.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRCtO-0006gD-9u for emacs-orgmode@gnu.org; Fri, 08 Jun 2018 04:37:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRCtM-0000oi-Fp for emacs-orgmode@gnu.org; Fri, 08 Jun 2018 04:37:06 -0400 Received: from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]:43168) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRCtM-0000oS-8r for emacs-orgmode@gnu.org; Fri, 08 Jun 2018 04:37:04 -0400 Received: by mail-wr0-x22d.google.com with SMTP id d2-v6so12465598wrm.10 for ; Fri, 08 Jun 2018 01:37:04 -0700 (PDT) Received: from debian ([2a01:e35:2ea9:9d00:8188:1d2c:a553:7f2f]) by smtp.gmail.com with ESMTPSA id y186-v6sm1941697wmd.38.2018.06.08.01.37.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jun 2018 01:37:01 -0700 (PDT) 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" Cc: "Liste-emacs-orgmode@gnu.org" --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: multipart/related; boundary="==-=-=" --==-=-= Content-Type: text/html

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):

(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")

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.

--==-=-=-- --=-=-=--