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