|
Re: Templates in Aquamacs: msg#00014emacs.macintosh.osx
On 8 Dec 2006, at 20:13, Matthew Cohen wrote: I would like to set up Aquamacs such that when I create a new file with the extension .tex, the resulting new buffer automatically contains the LaTeX preamble (i.e. documentclass definitions, etc.) that I use in nearly everything I write. Currently, I have a file called "template.tex" that I open and then immediately rename, but I'd like to avoid this step. One general solution - relatively independent of AUCTeX - would be to find a hook such as latex-mode-hook, which lists functions that are executed every time latex-mode is started. If the buffer is empty at that point, you insert the contents of the template file. Something like this: (defun my-latex-load-template () (when (eq (point-min) (point-max)) (insert-file "../.../../../my-template.tex"))) (add-to-hook 'latex-mode-hook 'my-latex-load-template) Of course you'll have to figure something out to allow for the initial comments in the file and still insert something. If AUCTeX offers this kind of functionality already, that would be preferable of course. Hope that helps. -- http://aquamacs.org -- Aquamacs: Emacs on Mac OS X http://aquamacs.org/donate -- Could we help you? Return the favor and support the Aquamacs Project! ---------------------------- Info ----------------------------- List Post: <mailto:macosx-emacs@xxxxxxxxxxxxxxxxx> List Archives: <http://dir.gmane.org/gmane.emacs.macintosh.osx> |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Templates in Aquamacs: 00014, Edward_M._Roche_=28=E6=B1=9F=E6=88=B8=E6=B5=AA?= =?UTF-8?Q?=E5=A3=AB=29 |
|---|---|
| Next by Date: | Re: Re: Re: Aquamacs with ProggyFonts?: 00014, Renzo Been |
| Previous by Thread: | Re: Templates in Aquamacsi: 00014, Peter Dyballa |
| Next by Thread: | Absolute beginners problem with Preferences.el: 00014, Torben Hoffmann |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |