help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: auto-insert-alist


From: kgold
Subject: Re: auto-insert-alist
Date: 14 Jul 2004 17:41:09 GMT

drmemory@starband.net (DrMemory) writes:
> I am having some trouble with auto-insertion.
> 
> According to the documentation, the "Action" can be a filename, in
> which case its contents are to be inserted. However, when I try this,
> I get no auto-insertion when I visit a new file:
> 
> (setq auto-insert-alist
>       (append '(((".*ltr.*\\.tex$" . "Letter") . "~/leg/ltr.tex"))
>             auto-insert-alist))
> 
> I changed it to:
> 
> (setq auto-insert-alist
>       (append '(((".*ltr.*\\.tex$" . "Letter") . 
>          (insert-file-contents "~/leg/ltr.tex")))
>             auto-insert-alist))
> 
> And now I am prompted for autoinsertion, but the result is just to
> have the string "~/leg/ltr.tex" inserted in the new file.
> 
> I hope someone can tell me what I am doing wrong...

You can try this until you get a real fix:

(add-hook 'find-file-hooks 'auto-insert)
(setq auto-insert-directory (expand-file-name "~/.autoinsert/"))
(setq auto-insert-query nil)
(define-auto-insert "\\.c\\'"           "autoinsert.c")
(define-auto-insert "\\.cpp\\'"         "autoinsert.c")
(define-auto-insert "\\.java\\'"        "autoinsert.java")
(define-auto-insert "\\.txt\\'"         "autoinsert.txt")


reply via email to

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