Skip to content

Commit

Permalink
defconst should be top-level.
Browse files Browse the repository at this point in the history
  • Loading branch information
gcv committed Jan 11, 2022
1 parent b3971c8 commit a4bfe49
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions julia-snail.el
Original file line number Diff line number Diff line change
Expand Up @@ -163,28 +163,30 @@ another."

;;; --- constants

(cl-labels ((list-extension-files (&optional (path "extensions"))
(let* ((result nil)
(entries (cl-remove-if
(lambda (entry)
(or (string-match-p "^\\." (file-name-nondirectory entry))
(and (file-regular-p entry)
(not (or (string-equal "jl" (downcase (or (file-name-extension entry) "")))
(string-equal "toml" (downcase (or (file-name-extension entry) ""))))))))
(directory-files path)))
(qualified-entries (if (string-equal "." path)
entries
(mapcar (lambda (entry)
(concat (file-name-as-directory path) entry))
entries))))
(cl-loop for entry in qualified-entries do
(if (file-regular-p entry)
(setq result (cons entry result))
(when (file-directory-p entry)
(setq result (cons entry result))
(setq result (append result (list-extension-files entry))))))
result)))
(defconst julia-snail--julia-files
(defconst julia-snail--julia-files
;; a slightly specialized directory walker to collect the correct file and directory list:
(cl-labels ((list-extension-files (&optional (path "extensions"))
(let* ((result nil)
(entries (cl-remove-if
(lambda (entry)
(or (string-match-p "^\\." (file-name-nondirectory entry))
(and (file-regular-p entry)
(not (or (string-equal "jl" (downcase (or (file-name-extension entry) "")))
(string-equal "toml" (downcase (or (file-name-extension entry) ""))))))))
(directory-files path)))
(qualified-entries (if (string-equal "." path)
entries
(mapcar (lambda (entry)
(concat (file-name-as-directory path) entry))
entries))))
(cl-loop for entry in qualified-entries do
(if (file-regular-p entry)
(setq result (cons entry result))
(when (file-directory-p entry)
(setq result (cons entry result))
(setq result (append result (list-extension-files entry))))))
result)))
;; actually put together the list
(append
(list "JuliaSnail.jl" "Manifest.toml" "Project.toml"
"extensions")
Expand Down

0 comments on commit a4bfe49

Please sign in to comment.