Search code examples
emacsemacs24

Emacs: Disable auto-fill minor mode when in idlwave major mode


In Emacs how do I stop the auto-fill minor mode from loading when I start the idlwave major mode?

So far I have been completely unsuccessful at figuring out how to do this. I have tried to use remove-hook for both idl-mode-hook and text-mode-hook without success.


Solution

  • You might have enabled auto-fill-mode as a global minor mode, so it is on in all buffers by default. If that is the case, the task is not so much not turning it on in idlwave-mode but rather turning it off.

    Most major modes provide a special hook variable: it's a list containing functions that are called whenever that major mode is invoked. For instance, with the following line you can make sure that auto-fill-mode will get turned off each time a buffer goes into idlwave-mode:

    (add-hook 'idlwave-mode-hook (lambda () (auto-fill-mode 0)))
    

    Put the above line in your init file (e.g. ~/.emacs or ~/.emacs.d/init.el) and auto-fill-mode should be turned off in idlwave mode after you restarted Emacs.