# HG changeset patch # User Stefan Monnier # Date 953694579 0 # Node ID a71efaa2008d8eb00996aa6b2e699eeda48b970e # Parent 03e06f15f3d46f6d4a62ec83162600e1a9a72eb5 (find-file-run-dired): Update docstring. (find-directory-functions): New hook. (find-file-noselect): Run find-directory-functions rather than calling dired directly. diff -r 03e06f15f3d4 -r a71efaa2008d lisp/files.el --- a/lisp/files.el Wed Mar 22 03:05:09 2000 +0000 +++ b/lisp/files.el Wed Mar 22 03:09:39 2000 +0000 @@ -274,10 +274,18 @@ :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 @@ -936,11 +944,13 @@ (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))