aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2004-09-18 23:57:10 +0000
committerLuc Teirlinck2004-09-18 23:57:10 +0000
commita869308616fbfe71e5a6ede6cb2be5fcc598dd1d (patch)
tree750b5418ea3dbdbfc432e99cdc47d4828e0ef459
parent2c51754c78492cb51745798042e703873979e9cc (diff)
downloademacs-a869308616fbfe71e5a6ede6cb2be5fcc598dd1d.tar.gz
emacs-a869308616fbfe71e5a6ede6cb2be5fcc598dd1d.zip
(after-change-major-mode-hook): New variable.
(run-mode-hooks): Implement it.
-rw-r--r--lisp/subr.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index d46263d383d..9db8b6c1b11 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1937,6 +1937,10 @@ in BODY."
1937(make-variable-buffer-local 'delayed-mode-hooks) 1937(make-variable-buffer-local 'delayed-mode-hooks)
1938(put 'delay-mode-hooks 'permanent-local t) 1938(put 'delay-mode-hooks 'permanent-local t)
1939 1939
1940(defvar after-change-major-mode-hook nil
1941 "Mode independent hook run after changing major modes.
1942This is run just before the mode dependent hooks.")
1943
1940(defun run-mode-hooks (&rest hooks) 1944(defun run-mode-hooks (&rest hooks)
1941 "Run mode hooks `delayed-mode-hooks' and HOOKS, or delay HOOKS. 1945 "Run mode hooks `delayed-mode-hooks' and HOOKS, or delay HOOKS.
1942Execution is delayed if `delay-mode-hooks' is non-nil. 1946Execution is delayed if `delay-mode-hooks' is non-nil.
@@ -1948,6 +1952,7 @@ Major mode functions should use this."
1948 ;; Normal case, just run the hook as before plus any delayed hooks. 1952 ;; Normal case, just run the hook as before plus any delayed hooks.
1949 (setq hooks (nconc (nreverse delayed-mode-hooks) hooks)) 1953 (setq hooks (nconc (nreverse delayed-mode-hooks) hooks))
1950 (setq delayed-mode-hooks nil) 1954 (setq delayed-mode-hooks nil)
1955 (run-hooks 'after-change-major-mode-hook)
1951 (apply 'run-hooks hooks))) 1956 (apply 'run-hooks hooks)))
1952 1957
1953(defmacro delay-mode-hooks (&rest body) 1958(defmacro delay-mode-hooks (&rest body)