all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* auto-insert-mode: define-auto-insert condition problem
@ 2013-02-15  8:08 Zhiming Wang
  2013-02-19 15:35 ` Kevin Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: Zhiming Wang @ 2013-02-15  8:08 UTC (permalink / raw)
  To: help-gnu-emacs

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

(require 'autoinsert)
(auto-insert-mode)
(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?

Thanks,
Kevin

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.


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

end of thread, other threads:[~2013-02-19 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.19989.1360916586.855.help-gnu-emacs@gnu.org>
2013-02-15 20:19 ` auto-insert-mode: define-auto-insert condition problem Michael Heerdegen
2013-02-15  8:08 Zhiming Wang
2013-02-19 15:35 ` Kevin Rodgers

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.