emacsnxhtml

Altering what Emacs loads depending upon file being editted


Currently, to use a certain plugin (nxhtml), I place the following statements in my .emacs,

(load "<plugin-location>/autostart.el")

Therefore everytime I open emacs, this is loaded, regardless of whether I am editing a file that the plug-in is applicable to (e.g. .htm). This loading is undesirable as it takes several seconds, how might I alter my settings so that this plug-in is loaded only when I am editing .htm or .css files?


Solution

  • nXhtml's autostart.el doesn't do a huge amount of work (it sets up autoload declarations in order to defer the real work until needed), however it can still be slow if you have not yet byte-compiled the library.

    nXhtml provides its own command for handling the necessary byte-compilation (which is documented at http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html), so you can just type:

    M-x nxhtmlmaint-start-byte-compilation RET