tags:

views:

19

answers:

1

I have I standard Emacs/nxhtml install. My nxhtml-autoload.el has the following line (I use .djhtml for my django template files)

(add-to-list 'auto-mode-alist '("\\.djhtml\\'"   . django-nxhtml-mumamo-mode))

I also use Emacs Desktop to re-open buffers ("save desktop state") when starting Emacs. When Emacs Desktop opens buffers, it fails to apply proper nxhtml mode however (django-nxhtml). I can apply the correct mode manually just fine and correct mode is used if I open new buffers.

Emacs desktop is placed at the very bottom of my init.el, so I don't understand why nxhtml is not applied when desktop recreates the old buffers?

+2  A: 

Were the buffers in question opened prior to adding & evaluating that auto-mode-alist entry?

The desktop library saves the major mode and minor modes currently associated with each buffer, and re-applies only those modes when restoring them (in order to put you back in the exact same state); so saving and restoring the desktop will not have the desired effect if the buffers were not already in the correct mode.

If you have a lot of files open, you could use ibuffer to revert (reload) them, so that the auto-mode kicks in: M-x ibuffer RET % f \.djhtml RET V

phils