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

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

Re: auto-insert-alist


From: DrMemory
Subject: Re: auto-insert-alist
Date: Wed, 14 Jul 2004 19:36:27 GMT
User-agent: slrn/0.9.5.7 (UNIX)

On Wed, 14 Jul 2004 11:56:52 -0600, Kevin Rodgers <ihs_4664@yahoo.com> wrote:
>DrMemory wrote:
> > 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...
>
>Maybe the ~ needs to be explicitly expanded; does this work:
>
>(setq auto-insert-alist
>       (cons `((".*ltr.*\\.tex$" . "Letter") . ,(expand-file-name
>                                               "~/leg/ltr.tex"))
>           auto-insert-alist))
>

Using expand-file-name does result in being prompted for
auto-insertion; however, what gets inserted is again the file-name
instead of the contents, just as happened when I tried
insert-file-contents! Sigh. I guess I'll have to go back and re-learn
how to write a template. This must be an error in the documentation or
else I'm just not reading it correctly?



reply via email to

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