This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+distributions/spacemacs-docker/funcs.el

52 lines
2.1 KiB
EmacsLisp
Raw Normal View History

2016-10-25 12:45:45 +00:00
;;; funcs.el --- Spacemacs Base Layer functions File
;;
2018-01-04 07:00:25 +00:00
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
2016-10-25 12:45:45 +00:00
;;
;; Author: Eugene "JAremko" Yaremenko <w3techplayground@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacemacs-docker//dump-layers-data ()
"Save used layers and their configurations to
the `spacemacs-docker-dump-layer-data-fp' file"
(with-temp-file spacemacs-docker-dump-layer-data-fp
2016-10-25 12:45:45 +00:00
(let ((used-layers (mapcar (lambda (el)
(or (car-safe el)
el))
dotspacemacs-configuration-layers)))
(insert (format "(setq used-layers '(%-20s%s))\n\n"
"\n"
(mapconcat 'symbol-name
used-layers
(format "%-20s"
"\n"))))
(insert "(setq used-layers-configs '(\n")
(dolist (layer used-layers)
(let ((names (all-completions (format "%s-"
layer)
obarray)))
(dolist (name names)
(let* ((symbol (intern-soft name))
2017-04-25 15:42:58 +00:00
(fp (when (boundp symbol) (symbol-file symbol)))
(sym-val (bound-and-true-p symbol)))
2016-10-25 12:45:45 +00:00
(when (or (and fp
(string-prefix-p
(configuration-layer/get-layer-path layer)
fp))
(string-match-p (regexp-quote "spacemacs-docker")
2016-10-25 12:45:45 +00:00
name))
(insert (format "%-28s(%s . %s)\n"
""
name
2017-04-25 15:42:58 +00:00
(if (stringp sym-val)
(format "\"%s\"" sym-val)
sym-val))))))))
2016-10-25 12:45:45 +00:00
(insert "))\n\n"))))
(defun spacemacs-docker//load-env ()
"Load environments variables collected from dependency installers."
(load-env-vars spacemacs-docker-env-fp))