'run' macro has been added to project dsl

This commit is contained in:
Sameer Rahmani 2018-03-20 21:19:27 +00:00
parent 80a756ac5f
commit 130c36e698
2 changed files with 14 additions and 6 deletions

View File

@ -3,9 +3,6 @@
;;; Code:
(require 'seq)
(defvar open-project-configurations (make-hash-table)
"This hashmap is responsible for storing project configurations.")
(defvar project-config-dir "~/.fg42/project-config/"
"This variable contains the path to the projects global configurations.")
@ -33,9 +30,10 @@
global-proj-config)))
(defun load-config-file (config)
"Load the given CONFIG file."
(defun load-config-file (project-name config)
"Load the given CONFIG file with the given PROJECT-NAME."
(require 'extensions/development/project-dsl)
(setq __project-name__ project-name)
(load config))
@ -45,7 +43,7 @@
(let* ((project (cdr (project-current)))
(config (config-path project)))
(if (not (equal nil config))
(load-config-file config)
(load-config-file project config)
(message "No configuration has been found for current project."))))

View File

@ -1,7 +1,17 @@
;;; project-dsl --- A dsl to be used with project configurations.
;;; Commentary:
;;; Code:
(defvar open-project-configurations (make-hash-table :test 'equal)
"This hashmap is responsible for storing project configurations.")
(defmacro run (body)
"It's going to run the given BODY when user wanted to run the project."
`(let ((pmap (gethash __project-name__
open-project-configurations
(make-hash-table :test 'equal))))
(puthash :run (lambda () ,body) pmap)
(puthash __project-name__ pmap open-project-configurations)))
(provide 'extensions/development/project-dsl)
;;; project-dsl ends here