doom-files-in: replace NOSORT w/ SORT; change default MATCH

- SORT defaults to t
- MATCH's new default regexp excludes files that start with underscore.
This commit is contained in:
Henrik Lissner 2019-06-16 15:27:49 +02:00
parent 39faabab6a
commit 5e9c020c21
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
8 changed files with 23 additions and 18 deletions

View file

@ -44,7 +44,7 @@ ready to be pasted in a bug report on github."
(length (doom-files-in `(,@doom-modules-dirs
,doom-core-dir
,doom-private-dir)
:type 'files :match "\\.elc$"))
:type 'files :match "\\.elc$" :sort nil))
(if IS-WINDOWS
"n/a"
(with-temp-buffer

View file

@ -10,13 +10,13 @@
filter
map
full
nosort
(sort t) ; TODO Allow a function for custom sorting?
(follow-symlinks t)
(type 'files)
(relative-to (unless full default-directory))
(depth 99999)
(mindepth 0)
(match "/[^.]"))
(match "/[^._]"))
"Returns a list of files/directories in PATH-OR-PATHS (one string path or a
list of them).
@ -45,7 +45,7 @@ MATCH is a string regexp. Only entries that match it will be included."
((let ((path path-or-paths)
result)
(when (file-directory-p path)
(dolist (file (directory-files path nil "." nosort))
(dolist (file (directory-files path nil "." sort))
(unless (member file '("." ".."))
(let ((fullpath (expand-file-name file path)))
(cond ((file-directory-p fullpath)

View file

@ -194,9 +194,11 @@ selection of all minor-modes, active or not."
"Search headlines in Doom's newsletters."
(interactive)
(doom-completing-read-org-headings
"Find in News: " (doom-files-in (expand-file-name "news" doom-docs-dir)
:match "/[0-9]"
:relative-to doom-docs-dir)
"Find in News: "
(nreverse (doom-files-in (expand-file-name "news" doom-docs-dir)
:match "/[0-9]"
:relative-to doom-docs-dir
:sort t))
nil t initial-input))
;;;###autoload

View file

@ -362,7 +362,8 @@ ones."
(doom-files-in doom-modules-dir
:depth 2
:full t
:match "/packages\\.el$"))
:match "/packages\\.el$"
:sort nil))
(cl-loop for key being the hash-keys of doom-modules
for path = (doom-module-path (car key) (cdr key) "packages.el")
for doom--current-module = key