From 085117a5c1c9f02ac337f1d38bbba3a0ae73b607 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Mon, 27 Dec 2010 17:28:53 +0330 Subject: [PATCH] license template loading done. needs test --- src/lib/project.el | 9 +++++---- src/plugins/cproject.el | 13 ++++++++++++- src/shit-ide.el | 7 +++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/lib/project.el b/src/lib/project.el index d0514ba..d0582ae 100644 --- a/src/lib/project.el +++ b/src/lib/project.el @@ -19,16 +19,17 @@ ;; Known licenses - Only free softwares license ;; I do not like users who use non-free licenses ;; TODO: gather a complete list of free software licenses - +;; TODO: build a hash variable from licenses (setq known-licenses '(gpl bsd cc)) + ;; Each project plugin should use this function for initializing a versy ;; basic New Project environment. (defun new-project () "New project basic function" (setq project-name (read-string "Project Name: ")) ;; Shit IDE use unix-project-name for dealing with project OS activity stuffs - (setq unix-project-name (replace-regexp-in-string "\ " "_" project-name)) + (setq unix-project-name (downcase (replace-regexp-in-string " " "_" project-name))) ;; if specified directory does not exists, shit will make it - (setq project-path (read-directory-name "Project Path: " nil nil nil project-name)) + (setq project-path (read-directory-name "Project Path: " nil nil nil unix-project-name)) (if (not (file-exists-p project-path)) (progn (mkdir project-path) @@ -38,7 +39,7 @@ ;; TODO: find a way to ask a multi choices question (setq project-license (read-string "Project License: ")) (if (not (member project-license known-licenses)) - (setq project-license "other") + (setq project-license nil) ) (setq project-author (read-string "Project Author: ")) (setq project-home-page (read-string "Home Page: ")) diff --git a/src/plugins/cproject.el b/src/plugins/cproject.el index af1f176..9a55ccc 100644 --- a/src/plugins/cproject.el +++ b/src/plugins/cproject.el @@ -21,7 +21,7 @@ (define-key global-map [menu-bar file new-proj cproj kmodule] '("Kernel Module" . kmodule)) (define-key global-map [menu-bar file new-proj cproj separator2] '("--")) - + (define-key global-map [Ctrl-x p c n ] 'make-cpp) (define-key global-map [menu-bar file new-proj cproj cpp-make] '("Make project (C++)" . make-cpp)) @@ -38,6 +38,9 @@ (define-key global-map [menu-bar file new-proj cproj cgeneric] '("Generic project (C)" . generic-c)) ) +;; Thsi function exists because maybe SHIT needs more information +;; about new project in the feature the new-prject function did not +;; cover (defun c-new-project () "Create a new C/C++ project" (new-project) ) @@ -45,5 +48,13 @@ (defun generic-c () "Create a generic type C project" (interactive) (c-new-project) + (setq current-template-file (concat TEMPLATESPATH "c/generic_c/main.c.tmpl")) + (if (project-license) + (let (license-data license-file) + (setq license-file (concat TEMPLATESPATH (concat "licenses/" (concat project-license ".tmpl")))) + (setq license-data (io/read license-file)) + (log license-data) + ) + ) ) (init-menus) \ No newline at end of file diff --git a/src/shit-ide.el b/src/shit-ide.el index f67573d..a6106e1 100644 --- a/src/shit-ide.el +++ b/src/shit-ide.el @@ -66,6 +66,13 @@ (if (= DEBUG 1) (message "[SHIT] DEBUG >>> %s" ARG)) ) + +(defun warning (ARG) "A wrapper around elisp built-in warn +function." + (warn "[SHIT] WARNING >>> %s ARG") + ) + + (defun start-shit () "A peace of shit configuration that tune emacs to be an IDE." (interactive)