mirror of
https://github.com/correl/melpa.git
synced 2024-12-23 19:19:51 +00:00
Normalise the file-list functions so they can be assessed for similarities
This commit is contained in:
parent
bd6ce27c31
commit
c9220870ed
1 changed files with 19 additions and 17 deletions
|
@ -468,31 +468,33 @@ of the same-named package which is to be kept."
|
|||
|
||||
(defun pb/source-file-list (files)
|
||||
"Generate a flat source file listing from FILES."
|
||||
(mapcan (lambda (fn) (if (consp fn)
|
||||
(pb/source-file-list (cdr fn))
|
||||
(list fn))) files))
|
||||
(mapcan (lambda (entry)
|
||||
(if (consp entry)
|
||||
(pb/source-file-list (cdr entry))
|
||||
(list entry)))
|
||||
files))
|
||||
|
||||
(defun pb/target-file-list (files)
|
||||
"Generate a flat target file listing from FILES."
|
||||
(loop for fn in files
|
||||
nconc (if (consp fn)
|
||||
(loop for res in (pb/target-file-list (cdr fn))
|
||||
collect (concat (car fn) "/" res))
|
||||
(list (file-name-nondirectory fn)))))
|
||||
|
||||
(mapcan (lambda (entry)
|
||||
(if (consp entry)
|
||||
(loop for res in (pb/target-file-list (cdr entry))
|
||||
collect (concat (car entry) "/" res))
|
||||
(list (file-name-nondirectory entry))))
|
||||
files))
|
||||
|
||||
(defun pb/expand-config-file-list (dir config)
|
||||
"In DIR, expand the :files for CONFIG and flatten the list."
|
||||
(pb/expand-file-list dir (or (plist-get config :files) (list "*.el"))))
|
||||
|
||||
(defun pb/expand-file-list (dir wildcards)
|
||||
"In DIR, expand WILDCARDS, some of which may be shell-style wildcards."
|
||||
(defun pb/expand-file-list (dir files)
|
||||
"In DIR, expand FILES, some of which may be shell-style wildcards."
|
||||
(mapcan (lambda (entry)
|
||||
(if (consp entry)
|
||||
(list (cons (car entry) (pb/expand-file-list dir (cdr entry))))
|
||||
(let ((default-directory dir))
|
||||
(mapcan (lambda (wc)
|
||||
(if (consp wc)
|
||||
(list (cons (car wc) (pb/expand-file-list dir (cdr wc))))
|
||||
(file-expand-wildcards wc)))
|
||||
wildcards)))
|
||||
(file-expand-wildcards entry))))
|
||||
files))
|
||||
|
||||
(defun pb/expand-source-file-list (dir config)
|
||||
"Shorthand way to expand paths in DIR for files listed in CONFIG."
|
||||
|
|
Loading…
Reference in a new issue