changeset 57145:26c822f42ae4

(after-change-major-mode-hook): New variable. (run-mode-hooks): Implement it.
author Luc Teirlinck <teirllm@auburn.edu>
date Sat, 18 Sep 2004 23:57:10 +0000
parents 1b899494bbe2
children 942b8e28d21a
files lisp/subr.el
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Sat Sep 18 21:36:02 2004 +0000
+++ b/lisp/subr.el	Sat Sep 18 23:57:10 2004 +0000
@@ -1937,6 +1937,10 @@
 (make-variable-buffer-local 'delayed-mode-hooks)
 (put 'delay-mode-hooks 'permanent-local t)
 
+(defvar after-change-major-mode-hook nil
+  "Mode independent hook run after changing major modes.
+This is run just before the mode dependent hooks.")
+
 (defun run-mode-hooks (&rest hooks)
   "Run mode hooks `delayed-mode-hooks' and HOOKS, or delay HOOKS.
 Execution is delayed if `delay-mode-hooks' is non-nil.
@@ -1948,6 +1952,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)
+    (run-hooks 'after-change-major-mode-hook)
     (apply 'run-hooks hooks)))
 
 (defmacro delay-mode-hooks (&rest body)