Skip to content

Commit

Permalink
feat(core): add +download-package-from-urls to pkgs from non-VC URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Dec 9, 2023
1 parent 0991708 commit 4300caf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/me-lib.el
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
;;; =================

(autoload 'cl-loop "cl-macs" nil nil 'macro)
(autoload 'url-filename "url-parse")
(autoload 'url-generic-parse-url "url-parse")

(require 'rx)

;;; === Some plist and alist missing functions ===
Expand Down Expand Up @@ -554,6 +557,20 @@ Works like `shell-command-to-string' with two differences:
"Is package PACKAGE disabled in `minemacs-disabled-packages'."
(and (memq package (apply #'append (mapcar #'ensure-list minemacs-disabled-packages))) t))

(defun +download-package-from-urls (pkgname &rest urls)
"Download PKGNAME files from URLS.
Returns the load path of the package, useful for usage with `use-package''s
`:load-path'."
(let* ((pkg-load-path (format "%s%s/" minemacs-extra-packages-dir pkgname))
(default-directory pkg-load-path))
(dolist (url urls)
(when-let* ((url-file-name (url-filename (url-generic-parse-url url)))
(url-file-name (file-name-nondirectory url-file-name)))
(unless (file-exists-p url-file-name)
(url-copy-file url url-file-name))))
pkg-load-path))

(defun minemacs-run-build-functions (&optional dont-ask-p)
"Run all build functions in `minemacs-build-functions'."
(interactive "P")
Expand Down
1 change: 1 addition & 0 deletions core/me-vars.el
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ environment variable \"$MINEMACS_IGNORE_USER_CONFIG\".")
(defconst minemacs-local-dir (concat minemacs-root-dir "local/"))
(defconst minemacs-cache-dir (concat minemacs-local-dir "cache/"))
(defconst minemacs-loaddefs-file (concat minemacs-core-dir "me-loaddefs.el"))
(defconst minemacs-extra-packages-dir (concat minemacs-local-dir "extra-packages/"))
(defconst minemacs-config-dir (file-name-as-directory
(or (getenv "MINEMACS_DIR") (getenv "MINEMACSDIR")
(if (file-directory-p "~/.minemacs.d/") "~/.minemacs.d/" (concat minemacs-root-dir "user-config/"))))
Expand Down

0 comments on commit 4300caf

Please sign in to comment.