summaryrefslogtreecommitdiff
path: root/lisp/cedet/srecode/args.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/cedet/srecode/args.el')
-rw-r--r--lisp/cedet/srecode/args.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/cedet/srecode/args.el b/lisp/cedet/srecode/args.el
index b91f96f611..d6798f7523 100644
--- a/lisp/cedet/srecode/args.el
+++ b/lisp/cedet/srecode/args.el
@@ -157,6 +157,30 @@ do not contain any text from preceding or following text."
(srecode-dictionary-show-section dict "RCS")
)))
+;;; :project ARGUMENT HANDLING
+;;
+;; When the :project argument is required, fill the dictionary with
+;; information that the current project (from EDE) might know
+(defun srecode-semantic-handle-:project (dict)
+ "Add macros into the dictionary DICT based on the current ede project."
+ (let* ((bfn (buffer-file-name))
+ (dir (file-name-directory bfn)))
+ (if (ede-toplevel)
+ (let* ((projecttop (ede-toplevel-project default-directory))
+ (relfname (file-relative-name bfn projecttop))
+ (reldir (file-relative-name dir projecttop))
+ )
+ (srecode-dictionary-set-value dict "PROJECT_FILENAME" relfname)
+ (srecode-dictionary-set-value dict "PROJECT_DIRECTORY" reldir)
+ (srecode-dictionary-set-value dict "PROJECT_NAME" (ede-name (ede-toplevel)))
+ (srecode-dictionary-set-value dict "PROJECT_VERSION" (oref (ede-toplevel) :version))
+ )
+ ;; If there is no EDE project, then put in some base values.
+ (srecode-dictionary-set-value dict "PROJECT_FILENAME" bfn)
+ (srecode-dictionary-set-value dict "PROJECT_DIRECTORY" dir)
+ (srecode-dictionary-set-value dict "PROJECT_NAME" "N/A")
+ (srecode-dictionary-set-value dict "PROJECT_VERSION" "1.0"))))
+
;;; :system ARGUMENT HANDLING
;;
;; When a :system argument is required, fill the dictionary with