From e6e267fcba9251bbb7eeb66ca55c08e47c635ab8 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 3 Oct 2009 19:28:05 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 36 +++++++++++++++++++++++++++++++ lisp/cedet/ede.el | 4 +++- lisp/cedet/ede/cpp-root.el | 4 ++-- lisp/cedet/ede/pmake.el | 36 ++++++++++++++++++++----------- lisp/cedet/ede/proj-comp.el | 12 +++++------ lisp/cedet/ede/srecode.el | 28 ++++++------------------ lisp/cedet/semantic.el | 16 +++++++++----- lisp/cedet/semantic/util-modes.el | 6 +++--- lisp/cedet/srecode/map.el | 7 ++---- lisp/cedet/srecode/srt-mode.el | 2 +- lisp/cedet/srecode/template.el | 10 ++++++--- lisp/files.el | 2 ++ 12 files changed, 104 insertions(+), 59 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 424d9860ac7..7ab1f0931b2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,39 @@ +2009-10-03 Chong Yidong + + * 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. + +2009-09-30 Eric Ludlam + + * 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. + 2009-10-03 Dan Nicolaescu * vc.el: Remove commented out code. diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el index 42c4508e52d..53087e12658 100644 --- a/lisp/cedet/ede.el +++ b/lisp/cedet/ede.el @@ -659,7 +659,9 @@ Argument MENU-DEF is the menu definition to use." "Target Forms" (let ((obj (or ede-selected-object ede-object))) (append - '([ "Add File" ede-add-file (ede-current-project) ] + '([ "Add File" ede-add-file + (and (ede-current-project) + (oref (ede-current-project) targets)) ] [ "Remove File" ede-remove-file (and ede-object (or (listp ede-object) diff --git a/lisp/cedet/ede/cpp-root.el b/lisp/cedet/ede/cpp-root.el index e1e348ac947..c30df8dbb0d 100644 --- a/lisp/cedet/ede/cpp-root.el +++ b/lisp/cedet/ede/cpp-root.el @@ -491,8 +491,8 @@ Also set up the lexical preprocessor map." (when (not table) (message "Cannot find file %s in project." F)) (when (and table (semanticdb-needs-refresh-p table)) - (semanticdb-refresh-table table)) - (setq spp (append spp (oref table lexical-table))))) + (semanticdb-refresh-table table) + (setq spp (append spp (oref table lexical-table)))))) (oref this spp-files)) spp)) diff --git a/lisp/cedet/ede/pmake.el b/lisp/cedet/ede/pmake.el index 4d3f8484ddd..79775429130 100644 --- a/lisp/cedet/ede/pmake.el +++ b/lisp/cedet/ede/pmake.el @@ -240,20 +240,32 @@ MFILENAME is the makefile to generate." "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 diff --git a/lisp/cedet/ede/proj-comp.el b/lisp/cedet/ede/proj-comp.el index 2bda2dd106e..be91c25d5f0 100644 --- a/lisp/cedet/ede/proj-comp.el +++ b/lisp/cedet/ede/proj-comp.el @@ -46,6 +46,7 @@ (require 'ede) ;source object (require 'ede/autoconf-edit) +(eval-when-compile (require 'ede/pmake)) ;;; Types: (defclass ede-compilation-program (eieio-instance-inheritor) @@ -256,12 +257,11 @@ This will prevent rules from creating duplicate variables or rules." (with-slots (variables) this (mapcar (lambda (var) - (insert (car var) "=") - (let ((cd (cdr var))) - (if (listp cd) - (mapc (lambda (c) (insert " " c)) cd) - (insert cd))) - (insert "\n")) + (ede-pmake-insert-variable-once (car var) + (let ((cd (cdr var))) + (if (listp cd) + (mapc (lambda (c) (insert " " c)) cd) + (insert cd))))) variables)))) (defmethod ede-compiler-intermediate-objects-p ((this ede-compiler)) diff --git a/lisp/cedet/ede/srecode.el b/lisp/cedet/ede/srecode.el index 5f64ed3c7d0..0870517a46e 100644 --- a/lisp/cedet/ede/srecode.el +++ b/lisp/cedet/ede/srecode.el @@ -37,27 +37,13 @@ ;;; Code: (defun ede-srecode-setup () - "Update various paths to get SRecode to identify our macros." - (let* ((lib (locate-library "ede.el" t)) - (ededir (file-name-directory lib)) - (tmpdir (file-name-as-directory - (expand-file-name "templates" ededir)))) - (when (not tmpdir) - (error "Unable to location EDE Templates directory")) - - ;; Rig up the map. - (require 'srecode/map) - (require 'srecode/find) - (add-to-list 'srecode-map-load-path tmpdir) - (srecode-map-update-map t) - - ;; We don't call this unless we need it. Load in the templates. - (srecode-load-tables-for-mode 'makefile-mode) - (srecode-load-tables-for-mode 'makefile-mode 'ede) - - ;; @todo - autoconf files. - - )) + "Initialize Srecode for EDE." + (require 'srecode/map) + (require 'srecode/find) + (srecode-map-update-map t) + ;; We don't call this unless we need it. Load in the templates. + (srecode-load-tables-for-mode 'makefile-mode) + (srecode-load-tables-for-mode 'makefile-mode 'ede)) (defmacro ede-srecode-insert-with-dictionary (template &rest forms) "Insert TEMPLATE after executing FORMS with a dictionary. diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el index a0c7db7b47d..03b04f1d5a5 100644 --- a/lisp/cedet/semantic.el +++ b/lisp/cedet/semantic.el @@ -176,7 +176,7 @@ For language specific hooks, make sure you define this as a local hook. This hook should not be used any more. Use `semantic-after-toplevel-cache-change-hook' instead.") -(make-obsolete-variable 'semantic-after-toplevel-bovinate-hook nil) +(make-obsolete-variable 'semantic-after-toplevel-bovinate-hook nil "23.2") (defvar semantic-after-toplevel-cache-change-hook nil "Hooks run after the buffer tag list has changed. @@ -661,7 +661,7 @@ Does nothing if the current buffer doesn't need reparsing." (defun semantic-bovinate-toplevel (&optional ignored) "Backward Compatibility Function." (semantic-fetch-tags)) -(make-obsolete 'semantic-bovinate-toplevel 'semantic-fetch-tags) +(make-obsolete 'semantic-bovinate-toplevel 'semantic-fetch-tags "23.2") ;; Another approach is to let Emacs call the parser on idle time, when ;; needed, use `semantic-fetch-available-tags' to only retrieve @@ -793,7 +793,7 @@ code blocks in methods. If `bovine-inner-scope' can also support commands, use `semantic-bovinate-from-nonterminal-full'." (semantic-parse-region start end nonterm depth t)) (make-obsolete 'semantic-bovinate-region-until-error - 'semantic-parse-region) + 'semantic-parse-region "23.2") (defsubst semantic-bovinate-from-nonterminal (start end nonterm &optional depth length) @@ -821,7 +821,7 @@ When used in a `lambda' of a MATCH-LIST, there is no need to include a START and END part." (semantic-parse-region start end nonterm (or depth 1))) (make-obsolete 'semantic-bovinate-from-nonterminal-full - 'semantic-parse-region) + 'semantic-parse-region "23.2") ;;; User interface @@ -1055,7 +1055,9 @@ Semantic mode. (add-hook 'makefile-mode-hook 'semantic-default-make-setup) (add-hook 'c-mode-hook 'semantic-default-c-setup) (add-hook 'c++-mode-hook 'semantic-default-c-setup) - (add-hook 'html-mode-hook 'semantic-default-html-setup)) + (add-hook 'html-mode-hook 'semantic-default-html-setup) + (add-hook 'html-mode-hook 'semantic-default-html-setup) + (add-hook 'srecode-template-mode-hook 'srecode-template-setup-parser)) ;; Disable all Semantic features. (remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn) (remove-hook 'javascript-mode-hook 'wisent-javascript-setup-parser) @@ -1066,6 +1068,7 @@ Semantic mode. (remove-hook 'c-mode-hook 'semantic-default-c-setup) (remove-hook 'c++-mode-hook 'semantic-default-c-setup) (remove-hook 'html-mode-hook 'semantic-default-html-setup) + (remove-hook 'srecode-template-mode-hook 'srecode-template-setup-parser) ;; FIXME: handle semanticdb-load-ebrowse-caches (dolist (mode semantic-submode-list) @@ -1104,6 +1107,9 @@ minor mode can be turned on only if semantic feature is available and the current buffer was set up for parsing. Return non-nil if the minor mode is enabled." t nil) +(autoload 'srecode-template-setup-parser "srecode/srecode-template" + "Set up buffer for parsing SRecode template files." t nil) + (provide 'semantic) ;; Semantic-util is a part of the semantic API. Include it last diff --git a/lisp/cedet/semantic/util-modes.el b/lisp/cedet/semantic/util-modes.el index b740b128941..592394465ae 100644 --- a/lisp/cedet/semantic/util-modes.el +++ b/lisp/cedet/semantic/util-modes.el @@ -874,7 +874,7 @@ when it lands in the sticky line." "Setup option `semantic-stickyfunc-mode'. For semantic enabled buffers, make the function declaration for the top most function \"sticky\". This is accomplished by putting the first line of -text for that function in Emacs 21's header line." +text for that function in the header line." (if semantic-stickyfunc-mode (progn (unless (and (featurep 'semantic) (semantic-active-p)) @@ -911,7 +911,7 @@ Enables/disables making the header line of functions sticky. A function (or other tag class specified by `semantic-stickyfunc-sticky-classes') has a header line, meaning the first line which describes the rest of the construct. This first -line is what is displayed in the Emacs 21 header line. +line is what is displayed in the header line. With prefix argument ARG, turn on if positive, otherwise off. The minor mode can be turned on only if semantic feature is available and @@ -1149,7 +1149,7 @@ current tag declaration." ;;;###autoload (defun semantic-highlight-func-mode (&optional arg) "Minor mode to highlight the first line of the current tag. -Enables/disables making the header line of functions sticky. +Enables/disables making the current function's first line light up. A function (or other tag class specified by `semantic-stickyfunc-sticky-classes') is highlighted, meaning the first line which describes the rest of the construct. diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el index 32723128325..dfe031c41ae 100644 --- a/lisp/cedet/srecode/map.el +++ b/lisp/cedet/srecode/map.el @@ -36,10 +36,7 @@ (defun srecode-map-base-template-dir () "Find the base template directory for SRecode." - (let* ((lib (locate-library "srecode.el")) - (dir (file-name-directory lib))) - (expand-file-name "templates/" dir) - )) + (expand-file-name "srecode" data-directory)) ;;; Current MAP ;; @@ -399,7 +396,7 @@ Return non-nil if the map changed." (list (srecode-map-base-template-dir) (expand-file-name "~/.srecode/") ) - "*Global load path for SRecode template files." + "Global load path for SRecode template files." :group 'srecode :type '(repeat file) :set 'srecode-map-load-path-set) diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el index 7b5322aa1fa..e10c163b8db 100644 --- a/lisp/cedet/srecode/srt-mode.el +++ b/lisp/cedet/srecode/srt-mode.el @@ -184,7 +184,7 @@ we can tell font lock about them.") ;;;###autoload (defun srecode-template-mode () - "Major-mode for writing srecode macros." + "Major-mode for writing SRecode macros." (interactive) (kill-all-local-variables) (setq major-mode 'srecode-template-mode diff --git a/lisp/cedet/srecode/template.el b/lisp/cedet/srecode/template.el index e20afd0c1c4..b4f372c1370 100644 --- a/lisp/cedet/srecode/template.el +++ b/lisp/cedet/srecode/template.el @@ -39,6 +39,7 @@ ans) )) +;;;###autoload (defun srecode-template-setup-parser () "Setup buffer for parse." (srecode-template-wy--install-parser) @@ -61,10 +62,13 @@ senator-step-at-tag-classes '(function variable) )) -;;;;###autoload -(add-hook 'srecode-template-mode-hook 'srecode-template-setup-parser) - (provide 'srecode/template) +;; Local variables: +;; generated-autoload-file: "loaddefs.el" +;; generated-autoload-feature: srecode/loaddefs +;; generated-autoload-load-name: "srecode/template" +;; End: + ;; arch-tag: 037fbca7-e846-4521-b801-3463f50c3080 ;;; srecode/template.el ends here diff --git a/lisp/files.el b/lisp/files.el index ac058efde08..4e8ae6cedcd 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2178,6 +2178,7 @@ since only a single case-insensitive search through the alist is made." ("\\.dtx\\'" . doctex-mode) ("\\.org\\'" . org-mode) ("\\.el\\'" . emacs-lisp-mode) + ("Project\\.ede\\'" . emacs-lisp-mode) ("\\.\\(scm\\|stk\\|ss\\|sch\\)\\'" . scheme-mode) ("\\.l\\'" . lisp-mode) ("\\.li?sp\\'" . lisp-mode) @@ -2237,6 +2238,7 @@ since only a single case-insensitive search through the alist is made." ("\\.f9[05]\\'" . f90-mode) ("\\.indent\\.pro\\'" . fundamental-mode) ; to avoid idlwave-mode ("\\.\\(pro\\|PRO\\)\\'" . idlwave-mode) + ("\\.srt\\'" . srecode-template-mode) ("\\.prolog\\'" . prolog-mode) ("\\.tar\\'" . tar-mode) ;; The list of archive file extensions should be in sync with -- 2.39.2