[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: locate-file in Emacs
From: |
Stefan Monnier |
Subject: |
Re: locate-file in Emacs |
Date: |
Wed, 17 Apr 2002 05:28:31 -0400 |
> Several years ago I talked to Richard Stallman about incorporating the
> `locate-file' function in Emacs. `locate-file' is a very useful
> XEmacs function that searches for a file in a path.
I like it.
This is obviously very convenient. It should ideally be
implemented on top of the `openp' function, such as the
quick-hack implementation below.
How important is the MODE argument ?
I would much prefer to have a PREDICATE argument instead (easier
to implement and more flexible). Also the current `openp' code
already checks for `file-readable-p' and `not file-directory-p'
rather than just file-readable-p.
Stefan
DEFUN ("locate-file", Flocate_file, Slocate_file, 2, 4, 0,
doc: /* Search for FILENAME through PATH.
If SUFFIXES is non-nil, it should be a list of suffixes to append to
file name when searching.
If MODE is non-nil, it should be a symbol or a list of symbols representing
requirements. Allowed symbols are `exists', `executable', `writable', and
`readable'. If MODE is nil, it defaults to `readable'. */)
(filename, path, suffixes, mode)
Lisp_Object filename, path_list, suffixes, mode;
{
Lisp_Object file;
/* FIXME: implement the `mode' functionality. */
int fd = openp (path, filename, suffixes, &file, 0);
if (fd > 0)
close (fd);
return file;
}
- locate-file in Emacs, Hrvoje Niksic, 2002/04/17
- Re: locate-file in Emacs, Eli Zaretskii, 2002/04/17
- Re: locate-file in Emacs,
Stefan Monnier <=
- Re: locate-file in Emacs, Hrvoje Niksic, 2002/04/17
- Re: locate-file in Emacs, Stefan Monnier, 2002/04/17
- Re: locate-file in Emacs, Hrvoje Niksic, 2002/04/18
- Re: locate-file in Emacs, Miles Bader, 2002/04/18
- Re: locate-file in Emacs, Hrvoje Niksic, 2002/04/18
- Re: locate-file in Emacs, Miles Bader, 2002/04/18
- Re: locate-file in Emacs, Stefan Monnier, 2002/04/18
- Re: locate-file in Emacs, Hrvoje Niksic, 2002/04/18
- Re: locate-file in Emacs, Stefan Monnier, 2002/04/18
- Re: locate-file in Emacs, Eli Zaretskii, 2002/04/18