If you want to customize a MajorMode, you may have to execute some code whenever the major mode is activated. This is done using the major mode hook. It usually has the same name as the major mode with “-hook” appended. Thus, in order to change some things in
text-mode, you’d add code to
Remember, most customizations can be set and saved using
customize-group. Only rarely will you need to put code on the hook. One such thing might be customization of font-lock keywords. See ShowWhiteSpace for an example.