How to have two different headers for two different modes with header2?

For instance, to have a header like :

% ----------
% File-name : 
% ----------

when I create a .el file and a header like :

# ----------
# Location :
# ----------

when I create a .R files.


From the Commentary of file header2.el:

;;     Mode-specific headers:
;;     ---------------------
;;      Not all headers need look alike.  Suppose that you have a unix script mode
;;      and want it to have a shell specifier line that all other headers do not
;;      have.  To do this, Place the following line in a hook called when the
;;      mode is invoked or in the code that establishes the mode:
;;         (add-hook 'make-header-hook 'header-shell nil t)
;;      The header building blocks are sensitive to the different comment
;;      characters in different modes.

In addition, if you need to you can make any of the user options that define parts of the header buffer-local, i.e., specific to a given mode. And if you really need to, you can do likewise for make-header-hook.

  • I already read this part of header2.el's header, but I don't understand how to do so.
    – P.-A.
    Jun 28 '16 at 19:14
  • I finally get it ! I defined two functions for locally setting make-header-hook and then added these functions to mode hooks. Thank you for your answer.
    – P.-A.
    Jul 1 '16 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.