I'm occasionally writing fanfiction-stories as plain-text files in emacs. It would be great if emacs could add a "header-section" in the beginning of these documents, for example:


Some fields - like Author and Email - could obviously be pre-filled...

How could something like this be accomplished in emacs?

What would be the best way of doing it? Would it be an idea to make a new major-mode - based on text-mode - called fanfic? Or perhaps a new minor-mode (called fanfic) to be used with the text-major-mode? A major/minor-mode could perhaps also set-up a few other things - like fly-spell-mode, auto-fill-mode and a suitable page-width...

For completeness, I'd like to know how such a standard header could be added for:

  • All new files created with emacs (just curious...)
  • All files of a certain type - eg. all .txt-files. (I guess it could be bound to the file-type (.txt) and/or the text-mode in emacs)
  • Files created with a customized major/minor-mode

I've used emacs for a several years, but haven't really dived into customization or elisp much... (why mess with perfection? ;-)


Browse other questions tagged or ask your own question.