emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106202: Replace fundamental-mode-hoo


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106202: Replace fundamental-mode-hook with change-major-mode-after-body-hook.
Date: Thu, 27 Oct 2011 11:01:40 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106202
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Thu 2011-10-27 11:01:40 +0800
message:
  Replace fundamental-mode-hook with change-major-mode-after-body-hook.
  
  * lisp/simple.el (fundamental-mode):
  * lisp/emacs-lisp/derived.el (define-derived-mode): Revert 2010-04-28
  change introducing fundamental-mode-hook.
  
  * lisp/subr.el (change-major-mode-after-body-hook): New hook.
  (run-mode-hooks): Run it.
  
  * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Use
  change-major-mode-before-body-hook.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/emacs-lisp/derived.el
  lisp/emacs-lisp/easy-mmode.el
  lisp/simple.el
  lisp/subr.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2011-10-26 13:42:33 +0000
+++ b/etc/NEWS  2011-10-27 03:01:40 +0000
@@ -1218,15 +1218,22 @@
 
 ** frame-local variables cannot be let-bound any more.
 
+** Major and minor mode changes
 +++
-** prog-mode is a new major-mode meant to be the parent of programming mode.
-The prog-mode-hook it defines can be used to enable features for
-programming modes.  For example:
-(add-hook 'prog-mode-hook 'flyspell-prog-mode)
-enables on the fly spell checking for comments and strings for
-programming modes.
-
-** define-minor-mode accepts a new keyword :variable.
+*** `prog-mode' is a new major mode from which programming modes
+should be derived.
+
+**** `prog-mode-hook' can be used to enable features for programming
+modes, e.g. (add-hook 'prog-mode-hook 'flyspell-prog-mode) to enable
+on-the-fly spell checking for comments and strings.
+
+*** New hook `change-major-mode-after-body-hook', run by
+`run-mode-hooks' just before any other mode hooks.
+
+*** Enabled globalized minor modes can be disabled in specific modes,
+by running (FOO-mode-hook 0) via a mode hook.
+
+*** `define-minor-mode' accepts a new keyword :variable.
 
 +++
 ** `delete-file' and `delete-directory' now accept optional arg TRASH.

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-10-26 14:07:31 +0000
+++ b/lisp/ChangeLog    2011-10-27 03:01:40 +0000
@@ -1,3 +1,15 @@
+2011-10-27  Chong Yidong  <address@hidden>
+
+       * subr.el (change-major-mode-after-body-hook): New hook.
+       (run-mode-hooks): Run it.
+
+       * emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Use
+       change-major-mode-before-body-hook.
+
+       * simple.el (fundamental-mode):
+       * emacs-lisp/derived.el (define-derived-mode): Revert 2010-04-28
+       change introducing fundamental-mode-hook.
+
 2011-10-26  Juanma Barranquero  <address@hidden>
 
        * term/w32-win.el (w32-default-color-map): Declare obsolete.  (Bug#9785)

=== modified file 'lisp/emacs-lisp/derived.el'
--- a/lisp/emacs-lisp/derived.el        2011-08-25 05:37:55 +0000
+++ b/lisp/emacs-lisp/derived.el        2011-10-27 03:01:40 +0000
@@ -230,7 +230,7 @@
                                        ; Run the parent.
         (delay-mode-hooks
 
-         (,(or parent 'fundamental-mode))
+         (,(or parent 'kill-all-local-variables))
                                        ; Identify the child mode.
          (setq major-mode (quote ,child))
          (setq mode-name ,name)

=== modified file 'lisp/emacs-lisp/easy-mmode.el'
--- a/lisp/emacs-lisp/easy-mmode.el     2011-10-24 17:37:03 +0000
+++ b/lisp/emacs-lisp/easy-mmode.el     2011-10-27 03:01:40 +0000
@@ -368,11 +368,13 @@
             (progn
               (add-hook 'after-change-major-mode-hook
                         ',MODE-enable-in-buffers)
-              (add-hook 'fundamental-mode-hook ',MODE-enable-in-buffers)
+              (add-hook 'change-major-mode-after-body-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 'change-major-mode-after-body-hook
+                       ',MODE-enable-in-buffers)
           (remove-hook 'find-file-hook ',MODE-check-buffers)
           (remove-hook 'change-major-mode-hook ',MODE-cmhh))
 

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2011-10-19 12:54:24 +0000
+++ b/lisp/simple.el    2011-10-27 03:01:40 +0000
@@ -349,7 +349,8 @@
 Other major modes are defined by comparison with this one."
   (interactive)
   (kill-all-local-variables)
-  (run-mode-hooks 'fundamental-mode-hook))
+  (unless delay-mode-hooks
+    (run-hooks 'after-change-major-mode-hook)))
 
 ;; Special major modes to view specially formatted data rather than files.
 

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2011-10-26 00:44:06 +0000
+++ b/lisp/subr.el      2011-10-27 03:01:40 +0000
@@ -1530,6 +1530,9 @@
 (make-variable-buffer-local 'delayed-mode-hooks)
 (put 'delay-mode-hooks 'permanent-local t)
 
+(defvar change-major-mode-after-body-hook nil
+  "Normal hook run in major mode functions, before the mode hooks.")
+
 (defvar after-change-major-mode-hook nil
   "Normal hook run at the very end of major mode functions.")
 
@@ -1546,7 +1549,7 @@
     ;; Normal case, just run the hook as before plus any delayed hooks.
     (setq hooks (nconc (nreverse delayed-mode-hooks) hooks))
     (setq delayed-mode-hooks nil)
-    (apply 'run-hooks hooks)
+    (apply 'run-hooks (cons 'change-major-mode-after-body-hook hooks))
     (run-hooks 'after-change-major-mode-hook)))
 
 (defmacro delay-mode-hooks (&rest body)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]