# HG changeset patch # User Stefan Monnier # Date 1272467917 14400 # Node ID cede0252a3950a0bdc9467cb73383dbdc99ed806 # Parent 533b15049ee751317867a88ef97913994252d748 Make it possible to locally disable a globally enabled mode. * simple.el (fundamental-mode): Run fundamental-mode-hook. * emacs-lisp/derived.el (define-derived-mode): Use fundamental-mode rather than kill-all-local-variables so it runs fundamental-mode-hook. * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Use fundamental-mode-hook to run MODE-enable-in-buffers earlier, so that subsequent hooks get a chance to disable it. diff -r 533b15049ee7 -r cede0252a395 lisp/ChangeLog --- a/lisp/ChangeLog Wed Apr 28 00:33:48 2010 -0700 +++ b/lisp/ChangeLog Wed Apr 28 11:18:37 2010 -0400 @@ -1,3 +1,13 @@ +2010-04-28 Stefan Monnier + + Make it possible to locally disable a globally enabled mode. + * simple.el (fundamental-mode): Run fundamental-mode-hook. + * emacs-lisp/derived.el (define-derived-mode): Use fundamental-mode + rather than kill-all-local-variables so it runs fundamental-mode-hook. + * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): + Use fundamental-mode-hook to run MODE-enable-in-buffers earlier, so + that subsequent hooks get a chance to disable it. + 2010-04-27 Stefan Monnier * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): diff -r 533b15049ee7 -r cede0252a395 lisp/emacs-lisp/derived.el --- a/lisp/emacs-lisp/derived.el Wed Apr 28 00:33:48 2010 -0700 +++ b/lisp/emacs-lisp/derived.el Wed Apr 28 11:18:37 2010 -0400 @@ -230,7 +230,7 @@ ; Run the parent. (delay-mode-hooks - (,(or parent 'kill-all-local-variables)) + (,(or parent 'fundamental-mode)) ; Identify the child mode. (setq major-mode (quote ,child)) (setq mode-name ,name) diff -r 533b15049ee7 -r cede0252a395 lisp/emacs-lisp/easy-mmode.el --- a/lisp/emacs-lisp/easy-mmode.el Wed Apr 28 00:33:48 2010 -0700 +++ b/lisp/emacs-lisp/easy-mmode.el Wed Apr 28 11:18:37 2010 -0400 @@ -338,9 +338,11 @@ (progn (add-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers) + (add-hook 'fundamental-mode-hook ',MODE-enable-in-buffers) (add-hook 'find-file-hook ',MODE-check-buffers) (add-hook 'change-major-mode-hook ',MODE-cmhh)) (remove-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers) + (remove-hook 'fundamental-mode-hook ',MODE-enable-in-buffers) (remove-hook 'find-file-hook ',MODE-check-buffers) (remove-hook 'change-major-mode-hook ',MODE-cmhh)) diff -r 533b15049ee7 -r cede0252a395 lisp/simple.el --- a/lisp/simple.el Wed Apr 28 00:33:48 2010 -0700 +++ b/lisp/simple.el Wed Apr 28 11:18:37 2010 -0400 @@ -401,8 +401,7 @@ Other major modes are defined by comparison with this one." (interactive) (kill-all-local-variables) - (unless delay-mode-hooks - (run-hooks 'after-change-major-mode-hook))) + (run-mode-hooks 'fundamental-mode-hook)) ;; Special major modes to view specially formatted data rather than files.