I customized my own header and want it to be inserted between the second and the third line of the document. Unfortunately I'm not very used to Lisp, therefore I have a hard time trying to find the corresponding lines in header2.el
. Any ideas on how to proceed?
Asked
Active
Viewed 70 times
0
1 Answers
2
As the Commentary of header2.el
says:
;; To have Emacs update file headers automatically whenever you save a
;; file, put this in your init file (~/.emacs):
;;
;; (autoload 'auto-update-file-header "header2")
;; (add-hook 'write-file-hooks 'auto-update-file-header)
;;
;; To have Emacs add a file header whenever you create a new file in
;; some mode, put this in your init file (~/.emacs):
;;
;; (autoload 'auto-make-header "header2")
;; (add-hook 'emacs-lisp-mode-hook 'auto-make-header)
;; (add-hook 'c-mode-common-hook 'auto-make-header)
If you want the header to contain two lines of your choice as its first two lines then just define a function that inserts those two lines, and put that function at the beginning of option make-header-hook
. E.g.:
(defun insert-my-first-two-lines ()
(insert "MY FIRST LINE")
(insert "MY SECOND LINE"))
M-x customize-option make-header-hook
Click INS
in Customize at the beginning of the default value of make-header-hook
, to insert insert-my-first-two-lines
:
INS DEL insert-my-first-two-lines
Save your customization.
Automatic updating of the header, by update-file-header
, will do nothing to those first two lines (which I guess is what you want). It changes only lines for which you have defined an updating action using register-file-header-action
.

Drew
- 75,699
- 9
- 109
- 225