[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

auto-insert-mode: define-auto-insert condition problem

From: Zhiming Wang
Subject: auto-insert-mode: define-auto-insert condition problem
Date: Fri, 15 Feb 2013 00:08:07 -0800

To use the auto insert mode, I have the following lines in my .emacs file:

(require 'autoinsert)
(setq auto-insert-directory "~/.mytemplates")
(setq auto-insert-query nil)
(define-auto-insert "\.c" "c.c")
(define-auto-insert "\.tex" "latex.tex")
;;; other templates...

This works fine when I create .c file, .tex file, etc. However, when I create 
files with extensions beginning with .c, .tex, etc. templates are also loaded. 
For instance, when creating foo.cpp, the c.c template is automatically loaded, 
which is not expected. Noticing this behavior I tried .text, and latex.tex 
template is loaded.

So, is there any way to strengthen the define-auto-insert CONDITION so that 
auto insert is activated only upon the exact extensions?


P.S. Here is the documentation of define-auto-insert in 23.4.1:

define-auto-insert is a compiled Lisp function in `autoinsert.el'.

(define-auto-insert CONDITION ACTION &optional AFTER)

Associate CONDITION with (additional) ACTION in `auto-insert-alist'.
Optional AFTER means to insert action after all existing actions for CONDITION,
or if CONDITION had no actions, after all other CONDITIONs.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]