s i s t e m a o p e r a c i o n a l m a g n u x l i n u x | ~/ · documentação · suporte · sobre |
Next
Previous
Contents
6. Dirty Tricks6.1 Inserting a header automaticallyEmacs allows you to hook some actions to any event (opening of a file, saving, running a new mode, etc).
The autoinsert library uses this feature: when you open a new file under Emacs, this library inserts, according to the type of the file, a standard header.
In our case, this standard header could well be the part declaring the document type (LinuxDoc), the title, the author, and the date.
I will describe here two ways to insert such a header. You could insert a template file containing the information to insert, or you could run an elisp routine.
by inserting a fileYou must first tell Emacs to run the
Add the following lines to your
(add-hook 'find-file-hooks 'auto-insert) (load-library "autoinsert") (setq auto-insert-directory "~/emacs/") (setq auto-insert-alist (append '((sgml-mode . "sgml-insert.sgml")) auto-insert-alist)) You can then write in the
by running a routineThis works like before, but instead of setting the
(add-hook 'find-file-hooks 'auto-insert) (load-library "autoinsert") (add-to-list 'load-path "~/emacs") (load-library "sgml-header") (setq auto-insert-alist (append '(((sgml-mode . "SGML Mode") . insert-sgml-header)) auto-insert-alist)) You will find in
appendix an
example of
Next Previous Contents |