Mercurial > emacs
changeset 28259:a71efaa2008d
(find-file-run-dired): Update docstring.
(find-directory-functions): New hook.
(find-file-noselect): Run find-directory-functions rather than
calling dired directly.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 22 Mar 2000 03:09:39 +0000 |
parents | 03e06f15f3d4 |
children | bc3a3319185f |
files | lisp/files.el |
diffstat | 1 files changed, 16 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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))