Normally, I need to enable the auto-fill-mode, so I have it turned on in .emacs. But when editting PHP in php-mode, I'd like to not use auto-fill-mode. Is there way to set it in .emacs such that when I'm in PHP mode, the auto-fill-paragraph mode is automatically turned off and when I leave php-mode, it's automatically turned on, barring other overriding?
Update: a closer examination of the .emacs revealed that auto-fill is set up by
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(column-number-mode t)
...
'(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
...)
auto-fill-modedoesn't look like it's global, so you have probably set that to be global somewhere in your user customization files. The easiest way I can think of to control its behavior is to put in an exception to the function that turns onauto-fill-mode(i.e., excludingphp-mode) (or create such a function), or simply use it as a buffer-local minor-mode that is enabled with major-mode hooks that you normally use. The docs state that it is a buffer-local minor-mode: gnu.org/software/emacs/manual/html_node/emacs/Auto-Fill.html - lawlistphp-modeis borrowing another major-mode) instead of a global setting issue, then perhaps you could try something like:(add-hook 'php-mode-hook (lambda () (auto-fill-mode -1)))The inheriting issue is one of the reasons that I set up my own text-mode that is distinct from the stock version -- i.e., so that other major modes don't inherit some text-mode settings.-1(negative integer) turns off a minor-mode. - lawlist