From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joseph Vidal-Rosset Subject: Re: autoinsert Date: Fri, 08 Jun 2018 09:32:54 +0200 Message-ID: <87r2lhn36h.fsf@gmail.com> References: <87muw6ldp5.fsf@gmail.com> <87k1rab92r.fsf@alphaville.usersys.redhat.com> <87a7s5wy47.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRBtL-0003kg-Eq for emacs-orgmode@gnu.org; Fri, 08 Jun 2018 03:33:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRBtJ-0004HR-Vy for emacs-orgmode@gnu.org; Fri, 08 Jun 2018 03:32:59 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:35668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRBtJ-0004H9-OX for emacs-orgmode@gnu.org; Fri, 08 Jun 2018 03:32:57 -0400 Received: by mail-wm0-x229.google.com with SMTP id j15-v6so1776478wme.0 for ; Fri, 08 Jun 2018 00:32:57 -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" To: Nick Dokos Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: multipart/related; boundary="==-=-=" --==-=-= Content-Type: text/html

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.

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