Skip to content

Commit

Permalink
Fix syl20bnr#14213 remove dash and ht from core libs
Browse files Browse the repository at this point in the history
- delete dash and ht in core
- reimplemented all ht functions we need in `spacemacs-ht.el` and use them
- add dash to spacemacs-bootstrap
  • Loading branch information
thanhvg authored and smile13241324 committed Feb 7, 2021
1 parent 884dc44 commit ae65f3c
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 3,595 deletions.
2 changes: 0 additions & 2 deletions .ci/built_in_manifest
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
https://raw.githubusercontent.com/magnars/dash.el/master/dash.el core/libs/dash.el
https://raw.githubusercontent.com/creichert/ido-vertical-mode.el/master/ido-vertical-mode.el core/libs/ido-vertical-mode.el
https://raw.githubusercontent.com/melpa/package-build/master/package-build.el core/libs/package-build.el
https://raw.githubusercontent.com/melpa/package-build/master/package-recipe-mode.el core/libs/package-recipe-mode.el
https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el core/libs/quelpa.el
https://raw.githubusercontent.com/Malabarba/spinner.el/master/spinner.el core/libs/spinner.el
https://raw.githubusercontent.com/Wilfred/ht.el/master/ht.el core/libs/ht.el
https://raw.githubusercontent.com/melpa/package-build/master/package-build-badges.el core/libs/package-build-badges.el
https://raw.githubusercontent.com/melpa/package-build/master/package-recipe.el core/libs/package-recipe.el
https://raw.githubusercontent.com/purcell/page-break-lines/master/page-break-lines.el core/libs/page-break-lines.el
Expand Down
3 changes: 1 addition & 2 deletions core/core-compilation.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
(defconst spacemacs--compiled-files
'(;; Built-in libs that we changed
"core/libs/forks/load-env-vars.el"
"core/libs/forks/spacemacs-ht.el"
;; Rest of built-in libs.
"core/libs/dash.el"
"core/libs/ht.el"
"core/libs/ido-vertical-mode.el"
"core/libs/package-build-badges.el"
"core/libs/package-build.el"
Expand Down
26 changes: 13 additions & 13 deletions core/core-configuration-layer.el
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
(require 'package)
(require 'warnings)
(require 'help-mode)
(require 'ht)
(require 'spacemacs-ht)
(require 'core-dotspacemacs)
(require 'core-funcs)
(require 'core-progress-bar)
Expand Down Expand Up @@ -1149,21 +1149,21 @@ USEDP non-nil means that PKG is a used layer."
(defun configuration-layer/get-layer (layer-name)
"Return a layer object with name LAYER-NAME.
Return nil if layer object is not found."
(when (ht-contains? configuration-layer--indexed-layers layer-name)
(ht-get configuration-layer--indexed-layers layer-name)))
(when (spacemacs-ht-contains? configuration-layer--indexed-layers layer-name)
(spacemacs-ht-get configuration-layer--indexed-layers layer-name)))

(defun configuration-layer/get-layers-list ()
"Return a list of all discovered layer symbols."
(ht-keys configuration-layer--indexed-layers))
(spacemacs-ht-keys configuration-layer--indexed-layers))

(defun configuration-layer/get-layer-local-dir (layer)
"Return the value of SLOT for the given LAYER."
(let ((obj (ht-get configuration-layer--indexed-layers layer)))
(let ((obj (spacemacs-ht-get configuration-layer--indexed-layers layer)))
(when obj (concat (oref obj :dir) "local/"))))

(defun configuration-layer/get-layer-path (layer)
"Return the path for LAYER symbol."
(let ((obj (ht-get configuration-layer--indexed-layers layer)))
(let ((obj (spacemacs-ht-get configuration-layer--indexed-layers layer)))
(when obj (oref obj :dir))))

(defun configuration-layer//add-package (pkg &optional usedp)
Expand All @@ -1176,13 +1176,13 @@ USEDP non-nil means that PKG is a used package."

(defun configuration-layer/get-packages-list ()
"Return a list of all package symbols."
(ht-keys configuration-layer--indexed-packages))
(spacemacs-ht-keys configuration-layer--indexed-packages))

(defun configuration-layer/get-package (pkg-name)
"Return a package object with name PKG-NAME.
Return nil if package object is not found."
(when (ht-contains? configuration-layer--indexed-packages pkg-name)
(ht-get configuration-layer--indexed-packages pkg-name)))
(when (spacemacs-ht-contains? configuration-layer--indexed-packages pkg-name)
(spacemacs-ht-get configuration-layer--indexed-packages pkg-name)))

(defun configuration-layer//sort-packages (packages)
"Return a sorted list of PACKAGES objects."
Expand Down Expand Up @@ -2272,7 +2272,7 @@ depends on it."
(deps (configuration-layer//get-package-deps-from-alist pkg-sym)))
(dolist (dep deps)
(let* ((dep-sym (car dep))
(value (ht-get result dep-sym)))
(value (spacemacs-ht-get result dep-sym)))
(puthash dep-sym
(if value (add-to-list 'value pkg-sym) (list pkg-sym))
result)))))
Expand Down Expand Up @@ -2301,8 +2301,8 @@ depends on it."
"Returns not nil if PKG-NAME is the name of an orphan package."
(unless (or (memq pkg-name dist-pkgs)
(memq pkg-name configuration-layer--protected-packages))
(if (ht-contains? dependencies pkg-name)
(let ((parents (ht-get dependencies pkg-name)))
(if (spacemacs-ht-contains? dependencies pkg-name)
(let ((parents (spacemacs-ht-get dependencies pkg-name)))
(cl-reduce (lambda (x y) (and x y))
(mapcar (lambda (p) (configuration-layer//is-package-orphan
p dist-pkgs dependencies))
Expand Down Expand Up @@ -2497,7 +2497,7 @@ depends on it."
"Return a list of all ELPA packages in indexed packages and dependencies."
(let (result)
(dolist (pkg-sym (configuration-layer//filter-distant-packages
(ht-keys configuration-layer--indexed-packages) nil))
(spacemacs-ht-keys configuration-layer--indexed-packages) nil))
(when (assq pkg-sym package-archive-contents)
(let* ((deps (mapcar 'car
(configuration-layer//get-package-deps-from-archive
Expand Down
Loading

0 comments on commit ae65f3c

Please sign in to comment.