An Introduction to Programming in Emacs Lisp Chapter 14
どうも。
最近暑くて,偏頭痛持ちには辛い季節になってまいりまして,
寝て起きると,暑くて頭が痛くなっているので,
起きたあとはほとんど冷えピタ貼っていて,あー,冷えピタはすげーなー,
これ考えた人はすげーよ,などと思っている whitypig どえーっす。
Chapter 14
- \\s_
- \sCODE
- matches any character whose syntax is CODE
- 「_」(アンダースコアね)
- symbol constituent
- \\S_
- whose syntax is NOT CODE
- \sCODE
- beginning of defun
- end of defun
- find-file-noselect
- バッファに注意は向けられない
- だから,set-buffer
- set-buffer
- 久しぶりに登場
- eval-expression-print-length
- リストが長いと省略されるとかそんなん
- nil に設定したけど,「...」される。。。
- sort
- string-lessp
- interactive
- D
- directory name
- D
- files-in-below-directory
今回は,Exercise がないので。。。
files-in-below-directory に手を入れてみました。(おー,なんかカックいい!!)
(defun my-files-in-below-directory (directory) "" (interactive "DDirectory name: ") (let (el-files-list (current-dir-list (directory-files directory t)) current-name) (while current-dir-list (setq current-name (car current-dir-list)) (if (not (file-directory-p current-name)) ; This is a file. (if (equal ".el" (substring current-name -3)) (setq el-files-list (cons current-name el-files-list))) ; This is a directory. (if (or (equal "." (substring current-name -1)) (equal ".." (substring current-name -2))) ;; `/.', `/..' で比較しないとまずいかもね〜。 () (setq el-files-list (append (my-files-in-below-directory current-name) el-files-list)))) (setq current-dir-list (cdr current-dir-list))) el-files-list)) ;; 一応確認してみるテスト。 (let ((l1 (files-in-below-directory "c:/opt/meadow3/lisp")) (l2 (my-files-in-below-directory "c:/opt/meadow3/lisp"))) (equal l1 l2)) ; => t ; うむ。おっけーっぽいな。