diff lisp/cedet/ede/pmake.el @ 105406:5b8c8cd21526

* cedet/srecode/srt-mode.el (srecode-template-mode): Doc fix. * files.el (auto-mode-alist): Add .srt and Project.ede. * cedet/semantic.el (semantic-mode): Handle srecode-template-mode-hook as well. * cedet/srecode/template.el: Remove hook variable. * cedet/ede/proj-comp.el: Require ede/pmake when compiling. * cedet/ede.el (ede-target-forms-menu): Don't enable if no projects exist. * cedet/srecode/map.el (srecode-map-base-template-dir): Look for templates in data-directory. * cedet/ede/srecode.el (ede-srecode-setup): Use default templates directory. * cedet/semantic/util-modes.el (semantic-highlight-func-mode): Doc fix. * cedet/ede/proj-comp.el (ede-proj-makefile-insert-variables): Only insert each variable once. * cedet/ede/pmake.el (ede-pmake-insert-variable-once): New macro. (ede-pmake-insert-variable-shared): Use it. * cedet/ede/cpp-root.el (ede-preprocessor-map): Do not deref table for lexical table iff table is nil.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 03 Oct 2009 19:28:05 +0000
parents 7f4c7f5c0eba
children bec7f10791da
line wrap: on
line diff
--- a/lisp/cedet/ede/pmake.el	Sat Oct 03 18:29:22 2009 +0000
+++ b/lisp/cedet/ede/pmake.el	Sat Oct 03 19:28:05 2009 +0000
@@ -240,20 +240,32 @@
   "Add VARNAME into the current Makefile.
 Execute BODY in a location where a value can be placed."
   `(let ((addcr t) (v ,varname))
-       (if (re-search-backward (concat "^" v "\\s-*=") nil t)
-	   (progn
-	     (ede-pmake-end-of-variable)
-	     (if (< (current-column) 40)
-		 (if (and (/= (preceding-char) ?=)
-			  (/= (preceding-char) ? ))
-		     (insert " "))
-	       (insert "\\\n   "))
-	     (setq addcr nil))
-	 (insert v "="))
+     (if (re-search-backward (concat "^" v "\\s-*=") nil t)
+	 (progn
+	   (ede-pmake-end-of-variable)
+	   (if (< (current-column) 40)
+	       (if (and (/= (preceding-char) ?=)
+			(/= (preceding-char) ? ))
+		   (insert " "))
+	     (insert "\\\n   "))
+	   (setq addcr nil))
+       (insert v "="))
+     ,@body
+     (if addcr (insert "\n"))
+     (goto-char (point-max))))
+(put 'ede-pmake-insert-variable-shared 'lisp-indent-function 1)
+
+(defmacro ede-pmake-insert-variable-once (varname &rest body)
+  "Add VARNAME into the current Makefile if it doesn't exist.
+Execute BODY in a location where a value can be placed."
+  `(let ((addcr t) (v ,varname))
+     (unless (re-search-backward (concat "^" v "\\s-*=") nil t)
+       (insert v "=")
        ,@body
        (if addcr (insert "\n"))
-       (goto-char (point-max))))
-(put 'ede-pmake-insert-variable-shared 'lisp-indent-function 1)
+       (goto-char (point-max)))
+     ))
+(put 'ede-pmake-insert-variable-once 'lisp-indent-function 1)
 
 ;;; SOURCE VARIABLE NAME CONSTRUCTION