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:
parent
39faabab6a
commit
5e9c020c21
8 changed files with 23 additions and 18 deletions
|
@ -44,7 +44,7 @@ ready to be pasted in a bug report on github."
|
||||||
(length (doom-files-in `(,@doom-modules-dirs
|
(length (doom-files-in `(,@doom-modules-dirs
|
||||||
,doom-core-dir
|
,doom-core-dir
|
||||||
,doom-private-dir)
|
,doom-private-dir)
|
||||||
:type 'files :match "\\.elc$"))
|
:type 'files :match "\\.elc$" :sort nil))
|
||||||
(if IS-WINDOWS
|
(if IS-WINDOWS
|
||||||
"n/a"
|
"n/a"
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
filter
|
filter
|
||||||
map
|
map
|
||||||
full
|
full
|
||||||
nosort
|
(sort t) ; TODO Allow a function for custom sorting?
|
||||||
(follow-symlinks t)
|
(follow-symlinks t)
|
||||||
(type 'files)
|
(type 'files)
|
||||||
(relative-to (unless full default-directory))
|
(relative-to (unless full default-directory))
|
||||||
(depth 99999)
|
(depth 99999)
|
||||||
(mindepth 0)
|
(mindepth 0)
|
||||||
(match "/[^.]"))
|
(match "/[^._]"))
|
||||||
"Returns a list of files/directories in PATH-OR-PATHS (one string path or a
|
"Returns a list of files/directories in PATH-OR-PATHS (one string path or a
|
||||||
list of them).
|
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)
|
((let ((path path-or-paths)
|
||||||
result)
|
result)
|
||||||
(when (file-directory-p path)
|
(when (file-directory-p path)
|
||||||
(dolist (file (directory-files path nil "." nosort))
|
(dolist (file (directory-files path nil "." sort))
|
||||||
(unless (member file '("." ".."))
|
(unless (member file '("." ".."))
|
||||||
(let ((fullpath (expand-file-name file path)))
|
(let ((fullpath (expand-file-name file path)))
|
||||||
(cond ((file-directory-p fullpath)
|
(cond ((file-directory-p fullpath)
|
||||||
|
|
|
@ -194,9 +194,11 @@ selection of all minor-modes, active or not."
|
||||||
"Search headlines in Doom's newsletters."
|
"Search headlines in Doom's newsletters."
|
||||||
(interactive)
|
(interactive)
|
||||||
(doom-completing-read-org-headings
|
(doom-completing-read-org-headings
|
||||||
"Find in News: " (doom-files-in (expand-file-name "news" doom-docs-dir)
|
"Find in News: "
|
||||||
|
(nreverse (doom-files-in (expand-file-name "news" doom-docs-dir)
|
||||||
:match "/[0-9]"
|
:match "/[0-9]"
|
||||||
:relative-to doom-docs-dir)
|
:relative-to doom-docs-dir
|
||||||
|
:sort t))
|
||||||
nil t initial-input))
|
nil t initial-input))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
|
@ -362,7 +362,8 @@ ones."
|
||||||
(doom-files-in doom-modules-dir
|
(doom-files-in doom-modules-dir
|
||||||
:depth 2
|
:depth 2
|
||||||
:full t
|
:full t
|
||||||
:match "/packages\\.el$"))
|
:match "/packages\\.el$"
|
||||||
|
:sort nil))
|
||||||
(cl-loop for key being the hash-keys of doom-modules
|
(cl-loop for key being the hash-keys of doom-modules
|
||||||
for path = (doom-module-path (car key) (cdr key) "packages.el")
|
for path = (doom-module-path (car key) (cdr key) "packages.el")
|
||||||
for doom--current-module = key
|
for doom--current-module = key
|
||||||
|
|
|
@ -255,7 +255,7 @@ Run this whenever your `doom!' block, or a module autoload file, is modified."
|
||||||
(when (file-exists-p auto-file)
|
(when (file-exists-p auto-file)
|
||||||
(push auto-file targets)
|
(push auto-file targets)
|
||||||
(if module-p (push auto-file enabled-targets)))
|
(if module-p (push auto-file enabled-targets)))
|
||||||
(dolist (file (doom-files-in auto-dir :match "\\.el$" :full t))
|
(dolist (file (doom-files-in auto-dir :match "\\.el$" :full t :sort nil))
|
||||||
(push file targets)
|
(push file targets)
|
||||||
(if module-p (push file enabled-targets)))))
|
(if module-p (push file enabled-targets)))))
|
||||||
(if (and (not force-p)
|
(if (and (not force-p)
|
||||||
|
|
|
@ -108,7 +108,7 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
||||||
;; Assemble el files we want to compile; taking into account that
|
;; Assemble el files we want to compile; taking into account that
|
||||||
;; MODULES may be a list of MODULE/SUBMODULE strings from the command
|
;; MODULES may be a list of MODULE/SUBMODULE strings from the command
|
||||||
;; line.
|
;; line.
|
||||||
(let ((target-files (doom-files-in targets :filter #'doom--byte-compile-ignore-file-p)))
|
(let ((target-files (doom-files-in targets :filter #'doom--byte-compile-ignore-file-p :sort nil)))
|
||||||
(when (or (not modules)
|
(when (or (not modules)
|
||||||
(member ":core" modules))
|
(member ":core" modules))
|
||||||
(push (expand-file-name "init.el" doom-emacs-dir)
|
(push (expand-file-name "init.el" doom-emacs-dir)
|
||||||
|
@ -175,10 +175,10 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
|
||||||
module. This does not include your byte-compiled, third party packages.'"
|
module. This does not include your byte-compiled, third party packages.'"
|
||||||
(cl-loop with default-directory = doom-emacs-dir
|
(cl-loop with default-directory = doom-emacs-dir
|
||||||
for path
|
for path
|
||||||
in (append (doom-files-in doom-emacs-dir :match "\\.elc$" :depth 0)
|
in (append (doom-files-in doom-emacs-dir :match "\\.elc$" :depth 0 :sort nil)
|
||||||
(doom-files-in doom-private-dir :match "\\.elc$" :depth 1)
|
(doom-files-in doom-private-dir :match "\\.elc$" :depth 1 :sort nil)
|
||||||
(doom-files-in doom-core-dir :match "\\.elc$")
|
(doom-files-in doom-core-dir :match "\\.elc$" :sort nil)
|
||||||
(doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4))
|
(doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4 :sort nil))
|
||||||
for truepath = (file-truename path)
|
for truepath = (file-truename path)
|
||||||
if (file-exists-p path)
|
if (file-exists-p path)
|
||||||
do (delete-file path)
|
do (delete-file path)
|
||||||
|
|
|
@ -32,7 +32,7 @@ If neither is available, run all tests in all enabled modules."
|
||||||
nconc (cl-loop for dir in doom-modules-dirs
|
nconc (cl-loop for dir in doom-modules-dirs
|
||||||
for path = (expand-file-name arg dir)
|
for path = (expand-file-name arg dir)
|
||||||
if (file-directory-p path)
|
if (file-directory-p path)
|
||||||
nconc (doom-files-in path :type 'dirs :depth 1 :full t))
|
nconc (doom-files-in path :type 'dirs :depth 1 :full t :sort nil))
|
||||||
finally do (setq argv nil))))
|
finally do (setq argv nil))))
|
||||||
|
|
||||||
(modules ; cons-cells given to MODULES
|
(modules ; cons-cells given to MODULES
|
||||||
|
|
|
@ -195,15 +195,17 @@ This doesn't require modules to be enabled. For enabled modules us
|
||||||
(intern module))))))))
|
(intern module))))))))
|
||||||
|
|
||||||
(defun doom-module-load-path (&optional all-p)
|
(defun doom-module-load-path (&optional all-p)
|
||||||
"Return a list of absolute file paths to activated modules. If ALL-P is
|
"Return an unsorted list of absolute file paths to activated modules.
|
||||||
non-nil, return paths of possible modules, activated or otherwise."
|
|
||||||
|
If ALL-P is non-nil, return paths of possible modules, activated or otherwise."
|
||||||
(declare (pure t) (side-effect-free t))
|
(declare (pure t) (side-effect-free t))
|
||||||
(append (if all-p
|
(append (if all-p
|
||||||
(doom-files-in doom-modules-dirs
|
(doom-files-in doom-modules-dirs
|
||||||
:type 'dirs
|
:type 'dirs
|
||||||
:mindepth 1
|
:mindepth 1
|
||||||
:depth 1
|
:depth 1
|
||||||
:full t)
|
:full t
|
||||||
|
:sort nil)
|
||||||
(cl-loop for plist being the hash-values of (doom-modules)
|
(cl-loop for plist being the hash-values of (doom-modules)
|
||||||
collect (plist-get plist :path)))
|
collect (plist-get plist :path)))
|
||||||
(list doom-private-dir)))
|
(list doom-private-dir)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue