[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master e820f16: Added file-tree-walk to files.el.
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] master e820f16: Added file-tree-walk to files.el. |
Date: |
Wed, 03 Dec 2014 10:31:00 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> +(defun file-tree-walk (dir action &rest args)
> + "Walk DIR executing ACTION. Each call gets as arguments DIR, a file path,
The first line should be self-sufficient, so better add a newline after
the ".".
> +and optional ARGS. The ACTION is applied to each subdirectory
^^
Use two spaces to separate sentences.
> +before descending into it, and if nil is returned at that point
> +the descent will be prevented. Directory entries are sorted with
> +string-lessp"
^^^
Don't forget to punctuate your docstrings.
I think C-u M-x checkdoc-current-buffer RET would have caught all those.
We really should try and setup flymake.el automatically for Elisp
buffers to flag those things on-the-fly.
> + (cond ((file-directory-p dir)
> + (or (char-equal ?/ (aref dir (1- (length dir))))
> + (setq dir (file-name-as-directory dir)))
> + (let ((lst (directory-files dir nil nil t))
Experience taught me that file-name-all-completions followed by testing
the presence of a trailing "/" is *much* faster because calling
file-directory-p on each entry ends up costly.
I got this trick from Eshell's code for ** globbing, where the speed
difference was a factor 10 when I tested it.
Stefan
- Re: [Emacs-diffs] master e820f16: Added file-tree-walk to files.el.,
Stefan Monnier <=
- Re: [Emacs-diffs] master e820f16: Added file-tree-walk to files.el., Eric S. Raymond, 2014/12/03
- Re: [Emacs-diffs] master e820f16: Added file-tree-walk to files.el., Stefan Monnier, 2014/12/03
- Metaproblem, part 3, Eric S. Raymond, 2014/12/03
- Re: Metaproblem, part 3, Stefan Monnier, 2014/12/03
- Re: Metaproblem, part 3, Eli Zaretskii, 2014/12/04
- Re: Metaproblem, part 3, Paul Eggert, 2014/12/04
- Re: Metaproblem, part 3, Stefan Monnier, 2014/12/04
- Re: Metaproblem, part 3, Lars Magne Ingebrigtsen, 2014/12/04
- Re: Metaproblem, part 3, Stefan Monnier, 2014/12/04
- Re: Metaproblem, part 3, Lars Magne Ingebrigtsen, 2014/12/04