aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2002-09-09 22:45:09 +0000
committerStefan Monnier2002-09-09 22:45:09 +0000
commit03741cc50b071bc2755506851f7c65cb6b321deb (patch)
tree3e055a8704cda877e6663be2abd18ce7b53efeef
parentf5e130577e9c1c43a4ea58b1062bff6b43346f7a (diff)
downloademacs-03741cc50b071bc2755506851f7c65cb6b321deb.tar.gz
emacs-03741cc50b071bc2755506851f7c65cb6b321deb.zip
(ff-pre-find-hook, ff-pre-load-hook, ff-post-load-hook)
(ff-not-found-hook, ff-file-created-hook): Rename from *-hooks. Update callers (but still run the old hooks as well).
-rw-r--r--lisp/find-file.el65
1 files changed, 30 insertions, 35 deletions
diff --git a/lisp/find-file.el b/lisp/find-file.el
index 1ecd6bc497d..8d8a282501d 100644
--- a/lisp/find-file.el
+++ b/lisp/find-file.el
@@ -101,13 +101,13 @@
101;; 101;;
102;; THERE ARE FIVE AVAILABLE HOOKS, called in this order if non-nil: 102;; THERE ARE FIVE AVAILABLE HOOKS, called in this order if non-nil:
103;; 103;;
104;; - ff-pre-find-hooks - called before the search for the other file starts 104;; - ff-pre-find-hook - called before the search for the other file starts
105;; - ff-not-found-hooks - called when the other file could not be found 105;; - ff-not-found-hook - called when the other file could not be found
106;; - ff-pre-load-hooks - called just before the other file is 'loaded' 106;; - ff-pre-load-hook - called just before the other file is 'loaded'
107;; - ff-file-created-hooks - called when the other file is created 107;; - ff-file-created-hook - called when the other file is created
108;; - ff-post-load-hooks - called just after the other file is 'loaded' 108;; - ff-post-load-hook - called just after the other file is 'loaded'
109;; 109;;
110;; The *load-hooks allow you to place point where you want it in the other 110;; The *load-hook allow you to place point where you want it in the other
111;; file. 111;; file.
112 112
113;; CREDITS: 113;; CREDITS:
@@ -130,27 +130,27 @@
130 :link '(emacs-commentary-link "find-file") 130 :link '(emacs-commentary-link "find-file")
131 :group 'find-file) 131 :group 'find-file)
132 132
133(defcustom ff-pre-find-hooks nil 133(defcustom ff-pre-find-hook nil
134 "*List of functions to be called before the search for the file starts." 134 "*List of functions to be called before the search for the file starts."
135 :type 'hook 135 :type 'hook
136 :group 'ff) 136 :group 'ff)
137 137
138(defcustom ff-pre-load-hooks nil 138(defcustom ff-pre-load-hook nil
139 "*List of functions to be called before the other file is loaded." 139 "*List of functions to be called before the other file is loaded."
140 :type 'hook 140 :type 'hook
141 :group 'ff) 141 :group 'ff)
142 142
143(defcustom ff-post-load-hooks nil 143(defcustom ff-post-load-hook nil
144 "*List of functions to be called after the other file is loaded." 144 "*List of functions to be called after the other file is loaded."
145 :type 'hook 145 :type 'hook
146 :group 'ff) 146 :group 'ff)
147 147
148(defcustom ff-not-found-hooks nil 148(defcustom ff-not-found-hook nil
149 "*List of functions to be called if the other file could not be found." 149 "*List of functions to be called if the other file could not be found."
150 :type 'hook 150 :type 'hook
151 :group 'ff) 151 :group 'ff)
152 152
153(defcustom ff-file-created-hooks nil 153(defcustom ff-file-created-hook nil
154 "*List of functions to be called if the other file needs to be created." 154 "*List of functions to be called if the other file needs to be created."
155 :type 'hook 155 :type 'hook
156 :group 'ff) 156 :group 'ff)
@@ -284,11 +284,11 @@ is created with the first matching extension (`.cc' yields `.hh')."
284;; No user definable variables beyond this point! 284;; No user definable variables beyond this point!
285;; ============================================== 285;; ==============================================
286 286
287(make-variable-buffer-local 'ff-pre-find-hooks) 287(make-variable-buffer-local 'ff-pre-find-hook)
288(make-variable-buffer-local 'ff-pre-load-hooks) 288(make-variable-buffer-local 'ff-pre-load-hook)
289(make-variable-buffer-local 'ff-post-load-hooks) 289(make-variable-buffer-local 'ff-post-load-hook)
290(make-variable-buffer-local 'ff-not-found-hooks) 290(make-variable-buffer-local 'ff-not-found-hook)
291(make-variable-buffer-local 'ff-file-created-hooks) 291(make-variable-buffer-local 'ff-file-created-hook)
292(make-variable-buffer-local 'ff-case-fold-search) 292(make-variable-buffer-local 'ff-case-fold-search)
293(make-variable-buffer-local 'ff-always-in-other-window) 293(make-variable-buffer-local 'ff-always-in-other-window)
294(make-variable-buffer-local 'ff-ignore-include) 294(make-variable-buffer-local 'ff-ignore-include)
@@ -350,19 +350,19 @@ Variables of interest include:
350 List of directories searched through with each extension specified in 350 List of directories searched through with each extension specified in
351 `ff-other-file-alist' that matches this file's extension. 351 `ff-other-file-alist' that matches this file's extension.
352 352
353 - `ff-pre-find-hooks' 353 - `ff-pre-find-hook'
354 List of functions to be called before the search for the file starts. 354 List of functions to be called before the search for the file starts.
355 355
356 - `ff-pre-load-hooks' 356 - `ff-pre-load-hook'
357 List of functions to be called before the other file is loaded. 357 List of functions to be called before the other file is loaded.
358 358
359 - `ff-post-load-hooks' 359 - `ff-post-load-hook'
360 List of functions to be called after the other file is loaded. 360 List of functions to be called after the other file is loaded.
361 361
362 - `ff-not-found-hooks' 362 - `ff-not-found-hook'
363 List of functions to be called if the other file could not be found. 363 List of functions to be called if the other file could not be found.
364 364
365 - `ff-file-created-hooks' 365 - `ff-file-created-hook'
366 List of functions to be called if the other file has been created." 366 List of functions to be called if the other file has been created."
367 (interactive "P") 367 (interactive "P")
368 (let ((ignore ff-ignore-include)) 368 (let ((ignore ff-ignore-include))
@@ -394,8 +394,7 @@ If optional IN-OTHER-WINDOW is non-nil, find the file in another window."
394 dirs ;; local value of ff-search-directories 394 dirs ;; local value of ff-search-directories
395 no-match) ;; whether we know about this kind of file 395 no-match) ;; whether we know about this kind of file
396 396
397 (if ff-pre-find-hooks 397 (run-hooks 'ff-pre-find-hook 'ff-pre-find-hooks)
398 (run-hooks 'ff-pre-find-hooks))
399 398
400 (message "Working...") 399 (message "Working...")
401 400
@@ -486,8 +485,7 @@ If optional IN-OTHER-WINDOW is non-nil, find the file in another window."
486 485
487 ((not found) ;; could not find the other file 486 ((not found) ;; could not find the other file
488 487
489 (if ff-not-found-hooks ;; run the hooks 488 (run-hooks 'ff-not-found-hook 'ff-not-found-hooks)
490 (run-hooks 'ff-not-found-hooks))
491 489
492 (cond 490 (cond
493 (ff-always-try-to-create ;; try to create the file 491 (ff-always-try-to-create ;; try to create the file
@@ -823,20 +821,17 @@ and on the global variable `ff-always-in-other-window'.
823F1 and F2 are typically `find-file' / `find-file-other-window' 821F1 and F2 are typically `find-file' / `find-file-other-window'
824or `switch-to-buffer' / `switch-to-buffer-other-window' function pairs. 822or `switch-to-buffer' / `switch-to-buffer-other-window' function pairs.
825 823
826If optional NEW-FILE is t, then a special hook (`ff-file-created-hooks') is 824If optional NEW-FILE is t, then a special hook (`ff-file-created-hook') is
827called before `ff-post-load-hooks'." 825called before `ff-post-load-hook'."
828 (if ff-pre-load-hooks 826 (run-hooks 'ff-pre-load-hook 'ff-pre-load-hooks)
829 (run-hooks 'ff-pre-load-hooks))
830 (if (or 827 (if (or
831 (and in-other-window (not ff-always-in-other-window)) 828 (and in-other-window (not ff-always-in-other-window))
832 (and (not in-other-window) ff-always-in-other-window)) 829 (and (not in-other-window) ff-always-in-other-window))
833 (funcall f2 file) 830 (funcall f2 file)
834 (funcall f1 file)) 831 (funcall f1 file))
835 (if new-file 832 (if new-file
836 (if ff-file-created-hooks 833 (run-hooks 'ff-file-created-hook 'ff-file-created-hooks))
837 (run-hooks 'ff-file-created-hooks))) 834 (run-hooks 'ff-post-load-hook 'ff-post-load-hooks))
838 (if ff-post-load-hooks
839 (run-hooks 'ff-post-load-hooks)))
840 835
841(defun ff-find-file (file &optional in-other-window new-file) 836(defun ff-find-file (file &optional in-other-window new-file)
842 "Like `find-file', but may show the file in another window." 837 "Like `find-file', but may show the file in another window."
@@ -947,7 +942,7 @@ and the name of the file passed in."
947 942
948;(eval-when-compile (require 'ada-mode)) 943;(eval-when-compile (require 'ada-mode))
949 944
950;; bind with (setq ff-pre-load-hooks 'ff-which-function-are-we-in) 945;; bind with (setq ff-pre-load-hook 'ff-which-function-are-we-in)
951;; 946;;
952(defun ff-which-function-are-we-in () 947(defun ff-which-function-are-we-in ()
953 "Return the name of the function whose definition/declaration point is in. 948 "Return the name of the function whose definition/declaration point is in.
@@ -965,7 +960,7 @@ Also remember that name in `ff-function-name'."
965 (match-end 0))) 960 (match-end 0)))
966 )))) 961 ))))
967 962
968;; bind with (setq ff-post-load-hooks 'ff-set-point-accordingly) 963;; bind with (setq ff-post-load-hook 'ff-set-point-accordingly)
969;; 964;;
970(defun ff-set-point-accordingly () 965(defun ff-set-point-accordingly ()
971 "Find the function specified in `ff-function-name'. 966 "Find the function specified in `ff-function-name'.