]> git.eshelyaron.com Git - emacs.git/commitdiff
Make it possible to locally disable a globally enabled mode.
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 28 Apr 2010 15:18:37 +0000 (11:18 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 28 Apr 2010 15:18:37 +0000 (11:18 -0400)
* 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.

lisp/ChangeLog
lisp/emacs-lisp/derived.el
lisp/emacs-lisp/easy-mmode.el
lisp/simple.el

index c35314af1b03075b6bf89ed9de4c79d81f04b7e6..03deb82d0b1e1dcbfaf387fc5e6610005adc28be 100644 (file)
@@ -1,3 +1,13 @@
+2010-04-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       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  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
index debef5535f5d6a794e3ef96681216999418041f2..d6f717ccda754bba68b55656a83c0c1c3f564db4 100644 (file)
@@ -230,7 +230,7 @@ No problems result if this variable is not bound.
                                        ; 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)
index d18aa230b75324b0ed34e305ec2608dd040ba037..bebff6adae85f9a6c9c79aa68c4fe3d4862370f2 100644 (file)
@@ -338,9 +338,11 @@ See `%s' for more information on %s."
             (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))
 
index f609755e8237f1a493767e40d8ec7e2db29f456e..cc70409ccd4ae1ed5eeccf85deaf92916decfa23 100644 (file)
@@ -401,8 +401,7 @@ location."
 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.