2000-03-21 Stefan Monnier <monnier@cs.yale.edu>
+ * files.el (find-file-run-dired): Update docstring.
+ (find-directory-functions): New hook.
+ (find-file-noselect): Run find-directory-functions rather than
+ calling dired directly.
+
+ * menu-bar.el (pcl-cvs): Add an entry for PCL-CVS' global menu.
+
* pcvs.el: Add a minimal leading commentary.
(cvs-make-cvs-buffer): Change the header part by removing the startup
message and adding a `Module' entry. Also replace the FOOTER and
:group 'abbrev)
(defcustom find-file-run-dired t
- "*Non-nil says run dired if `find-file' is given the name of a directory."
+ "*Non-nil means allow `find-file' to visit directories.
+To visit the directory, `find-file' runs `find-directory-functions'."
:type 'boolean
:group 'find-file)
+(defcustom find-directory-functions '(cvs-dired-noselect dired-noselect)
+ "*List of functions to try in sequence to visit a directory.
+Each function is called with the directory name as the sole argument
+and should return either a buffer or nil."
+ :type '(hook :options (cvs-dired-noselect dired-noselect))
+ :group 'find-file)
+
;;;It is not useful to make this a local variable.
;;;(put 'find-file-not-found-hooks 'permanent-local t)
(defvar find-file-not-found-hooks nil
(abbreviate-file-name
(expand-file-name filename)))
(if (file-directory-p filename)
- (if find-file-run-dired
- (dired-noselect (if find-file-visit-truename
- (abbreviate-file-name (file-truename filename))
- filename))
- (error "%s is a directory" filename))
+ (or (and find-file-run-dired
+ (run-hook-with-args-until-success
+ 'find-directory-functions
+ (if find-file-visit-truename
+ (abbreviate-file-name (file-truename filename))
+ filename)))
+ (error "%s is a directory" filename))
(if (and wildcards
find-file-wildcards
(not (string-match "\\`/:" filename))