help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quickly find all executables


From: Kin Cho
Subject: Re: quickly find all executables
Date: 24 Jul 2003 10:19:07 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Kevin Rodgers <address@hidden> writes:

> (let ((directories exec-path)
>       (executables '()))
>   (while directories
>     (let ((files (if (file-directory-p (car directories))
>                    (directory-files (car directories) t nil t)
>                  '())))
>       (while files
>       (if (and (file-regular-p (car files))
>                (file-executable-p (car files)))
>           (setq executables (cons (car files) executables)))
>       (setq files (cdr files))))
>     (setq directories (cdr directories)))
>   (nreverse executables))

Thanks.  I used add-to-list above to avoid adding duplicates that
won't be used anyway.

-kin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]