From 130c36e698fefeac88f89741a891bfacb82c7172 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Tue, 20 Mar 2018 21:19:27 +0000 Subject: [PATCH] 'run' macro has been added to project dsl --- lib/extensions/development/project-configuration.el | 10 ++++------ lib/extensions/development/project-dsl.el | 10 ++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/extensions/development/project-configuration.el b/lib/extensions/development/project-configuration.el index e9cb9fd..5d9f010 100644 --- a/lib/extensions/development/project-configuration.el +++ b/lib/extensions/development/project-configuration.el @@ -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.")))) diff --git a/lib/extensions/development/project-dsl.el b/lib/extensions/development/project-dsl.el index dd76ee2..f506129 100644 --- a/lib/extensions/development/project-dsl.el +++ b/lib/extensions/development/project-dsl.el @@ -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