2015-07-07 10:42:08 +01:00
|
|
|
(require 'cl-lib)
|
|
|
|
(require 'fg42/extension)
|
|
|
|
|
2015-07-09 11:05:09 +01:00
|
|
|
;; Functions ------------------------------
|
2015-07-07 10:42:08 +01:00
|
|
|
(defun load--extension (extension)
|
|
|
|
"Load a single extension and call its :on-initialize function"
|
2015-07-07 12:25:06 +01:00
|
|
|
(let ((lib (concat "extensions/" (symbol-name extension))))
|
|
|
|
(require (intern lib))))
|
|
|
|
|
|
|
|
(defun initialize--extension (extension)
|
|
|
|
"Initialize given extension by calling its :on-initialize function."
|
|
|
|
(let ((init-func (fg42-extension-on-initialize (symbol-value extension))))
|
2015-07-07 10:42:08 +01:00
|
|
|
(funcall (symbol-function init-func))))
|
|
|
|
|
2015-07-07 12:25:06 +01:00
|
|
|
(defun initialize-extensions ()
|
|
|
|
"Call the :on-initialize function on all extensions."
|
2015-07-09 11:05:09 +01:00
|
|
|
(mapcar 'initialize--extension activated-extensions))
|
2015-07-07 10:42:08 +01:00
|
|
|
|
2015-07-07 12:25:06 +01:00
|
|
|
(defun activate-extensions (&rest extensions)
|
2015-07-07 10:42:08 +01:00
|
|
|
"Mark given plugins to load on FG42"
|
2015-07-07 12:25:06 +01:00
|
|
|
(setq activated-extensions extensions)
|
2015-07-07 10:42:08 +01:00
|
|
|
(mapcar 'load--extension extensions))
|
|
|
|
|
2015-07-09 11:05:09 +01:00
|
|
|
(defun load-user-config (file)
|
|
|
|
"Load the given path as user config file"
|
|
|
|
(if (file-exists-p file)
|
|
|
|
(load-file file)))
|
|
|
|
|
2015-07-07 10:42:08 +01:00
|
|
|
(provide 'fg42/base)
|