From: Xue Fuqiao <xfq.free@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: About `current-directory-list'
Date: Sun, 23 Dec 2012 09:58:22 +0800 [thread overview]
Message-ID: <20121223095822.cb9d088ef9fbf18833def4b1@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 571 bytes --]
In node 14.9.2 of Bob's `An Introduction to Programming in Emacs Lisp'(http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/Files-List.html#Files-List), there is a function called `files-in-below-directory' that lists the .el files in a directory and its subdirs.
The varlist of the `let' special form is:
(el-files-list
(current-directory-list
(directory-files-and-attributes directory t)))
I don't know what does `current-directory-list' means, in my Emacs(24.2), there isn't a function named `current-directory-list'. Can anybody help?
--
Best regards.
[-- Attachment #2: filelist.el --]
[-- Type: application/octet-stream, Size: 1715 bytes --]
(defun files-in-below-directory (directory)
"List the .el files in DIRECTORY and in its sub-directories."
;; Although the function will be used non-interactively,
;; it will be easier to test if we make it interactive.
;; The directory will have a name such as
;; "/usr/local/share/emacs/22.1.1/lisp/"
(interactive "DDirectory name: ")
(let (el-files-list
(current-directory-list
(directory-files-and-attributes directory t)))
;; while we are in the current directory
(while current-directory-list
(cond
;; check to see whether filename ends in `.el'
;; and if so, append its name to a list.
((equal ".el" (substring (car (car current-directory-list)) -3))
(setq el-files-list
(cons (car (car current-directory-list)) el-files-list)))
;; check whether filename is that of a directory
((eq t (car (cdr (car current-directory-list))))
;; decide whether to skip or recurse
(if
(equal "."
(substring (car (car current-directory-list)) -1))
;; then do nothing since filename is that of
;; current directory or parent, "." or ".."
()
;; else descend into the directory and repeat the process
(setq el-files-list
(append
(files-in-below-directory
(car (car current-directory-list)))
el-files-list)))))
;; move to the next filename in the list; this also
;; shortens the list so the while loop eventually comes to an end
(setq current-directory-list (cdr current-directory-list)))
;; return the filenames
el-files-list))
next reply other threads:[~2012-12-23 1:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-23 1:58 Xue Fuqiao [this message]
2012-12-23 2:25 ` About `current-directory-list' Drew Adams
2012-12-23 2:42 ` Xue Fuqiao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121223095822.cb9d088ef9fbf18833def4b1@gmail.com \
--to=xfq.free@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.