summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Engster <deng@randomsample.de>2014-11-10 01:04:30 +0100
committerDavid Engster <dengste@eml.cc>2014-11-10 01:04:30 +0100
commit5d4da32d4ec662febf3a2f59b713229867f743cb (patch)
tree2ea5eb48dd6dee72f4bbb56bb22922454a91c9a4
parentd3dba954b3fbbbad3d858756999752328ab6cee6 (diff)
Update from CEDET trunk.
* grammars/c.by (template-type): Add :template-specifier and :typevar to capture extra details about the template. (opt-post-fcn-modifiers): Splice in the found symbol into the return value correctly. (QUESTION): New punctuation. (expression): Add ternary conditional support. * grammars/scheme.by (MODULE): New token. (scheme): Handle expanding the MODULE tag. (scheme-list): Remove closeparen required match. (scheme-in-list): Remove extraneous matches for DEFINE. Add support for MODULE Simplify matching for code & make work. (name-args, name-arg-list, name-arg-expand): Make it work. * semantic.el (semantic-mode): Add/remove 3 completion-at-point-functions. (semantic-completion-at-point-function): Removed. (semantic-analyze-completion-at-point-function) (semantic-analyze-notc-completion-at-point-function) (semantic-analyze-nolongprefix-completion-at-point-function): New completion at point functions. * semantic/doc.el (semantic-doc-snarf-comment-for-tag): Fix case when comment-end is empty string. * semantic/debug.el (semantic-debug-parser-debugger-source): New buffer local variable. (semantic-debug-interface): Add 'nil' initform to overlays. (semantic-debug-mode): Remove read-only tags from buffers on exit. (semantic-debug): Add autoload cookie. Force the language specific debugger to load. * semantic/db.el (generic::semanticdb-full-filename): New generic method to allow this method to be used on buffer names via an associated database. * semantic/symref.el (semantic-symref-cleanup-recent-buffers-fcn): When cleaning up buffers, don't clean up buffers that are being used (i.e., in a window) when the hook fires. (semantic-symref-recently-opened-buffers): New tracking variable. (semantic-symref-cleanup-recent-buffers-fcn): New hook fcn. (semantic-symref-result-get-tags): Move logic into `semantic-symref-hit-to-tag-via-buffer', and cleanup buffers via the symref cleanup function in post-command-hook. (semantic-symref-hit-to-tag-via-buffer): Logic that used to be from above. (semantic-symref-hit-to-tag-via-db): New. * semantic/analyze.el: (semantic-analyze-find-tag-sequence-default): If first entry in sequence is the only one, apply tagclass filter. (semantic-analyze-princ-sequence): Show slot even if empty. (semantic-analyze-find-tag-sequence) (semantic-analyze-find-tag-sequence-default): Add flags argument. Add support for forcing the final entry of the sequence to be of class variable. (semantic-analyze-find-tag): Fix bug where input class filter was ignored if there was a typecache match. (semantic-analyze-current-context-default): For assignments, the assignee now must be of class variable. * semantic/analyze/complete.el (semantic-analyze-possible-completions-default): Add 'no-longprefix' flag. When used, the prefix and prefixtypes are shortened to just the last symbol. * semantic/bovine/c.el (semantic-c-do-lex-if): Catch errors from 'hideif', and push to the parser warning stack. (semantic-lex-cpp-define): When a comment is at the end of a macro, do not subtract an extra 1 from the found position. Fixes bug with: #define foo (a)/**/ adding an extra ')' to the stream. * semantic/bovine/scm.el (semantic-lex-scheme-symbol): Allow symbols to be one char long. * semantic/bovine/grammar.el (bovine-grammar-calculate-source-on-path): New. (bovine-grammar-setupcode-builder): Use it. * ede.el (ede/detect): New require. (ede-version): Bump version (ede-initialize-state-current-buffer): Use new `ede-detect-directory-for-project' to detect projects first instead of depending on currente dir only. (ede-delete-project-from-global-list): New. (ede-flush-deleted-projects): Use above. (ede-check-project-query-fcn): New variable (ede-check-project-directory): Use above when querying the user. Added to support unit testing of this security measure. (ede-initialize-state-current-buffer): Use `ede-directory-project-cons' instead of the -detect- fcn to take advantage of the cache. Pass found project into `ede-load-project-file'. (ede-load-project-file): Add new input DETECTIN. (ede-rescan-toplevel): Get the proj root a better way. (ede-load-project-file): Return the loaded object. When asking for existing project, ask for an exact match. (ede-initialize-state-current-buffer): Simplify some conditional logic. (ede-load-project-file): Simplify conditional logic. (ede-global-list-sanity-check): New Testing fcn. (ede-parent-project): Replace old code with call to faster `ede-find-subproject-for-directory'. (ede-load-project-file): Use `ede-directory-get-toplevel-open-project' instead of above deleted. Rename "pfc" to "autoloader". Use `ede-directory-project-cons' to detect a project. Delete no project found case where we search up the tree. * ede/auto.el (ede-project-autoload): Fix doc typo. Add `:root-only' slot. (ede-auto-load-project): Doc update: warn to not use. (ede-dir-to-projectfile): Deleted. (ede-project-autoload-dirmatch): Add subdir-only slot. Make configdatastash unbound by default. (ede-do-dirmatch): If subdir-only is true, then don't allow exact matches. Account for configdatastash as unbound. Assume value of nil means no tool installed. Make sure loaded path matches from beginning. Stash the regexp, not the raw string. (ede-project-class-files): Note that makefile and automake are not root only. (ede-auto-detect-in-dir): New (for use with `ede/detect.el'). (ede-project-dirmatch-p): Deleted. (ede-project-root-directory): Remove body, return nil. (ede-project-autoload): :proj-root-dirmatch can be null & doc fix. (ede-auto-detect-in-dir): If there is no :proj-file, check for a dirmatch. * ede/generic.el (ede/config): Replace require of ede. (ede-generic-new-autoloader): Generic projects are now safe by default. Note this is NOT a root only project. (project-rescan, ede-project-root, ede-generic-target-java) (ede-java-classpath, ede-find-subproject-for-directory): New. (ede-enable-generic-projects): Add new autoloaders for git, bzr, hg, sv, CVS. (ede-generic-vc-project) (ede-generic-vc-project::ede-generic-setup-configuration): New. (ede-generic-config): Remove slots: c-include-path, c-preprocessor-table, c-preprocessor-files, classpath, build-command, debug-command, run command. Inherit from ede-extra-config-build, ede-extra-config-program. Make run-command :value match :custom so only strings are accepted. Add some more :group slot specifiers. (ede-generic-project): Add mixins `ede-project-with-config-c' and `ede-project-with-config-java'. Inherit from `ede-project-with-config-build', `ede-project-with-config-program'. Subclass `ede-project-with-config'. Remove duplication from new baseclass. (ede-generic-target): Inherit from `ede-target-with-config-build', `ede-target-with-config-program'. Subclass `ede-target-with-config'. (ede-generic-target-c-cpp): Add mixin `ede-target-with-config-c'. (ede-generic-target-java): Add mixin `ede-target-with-config-java'. (ede-preprocessor-map, ede-system-include-path) (edejava-classpath): Deleted, moved to config.el. (project-compile-project, project-compile-target) (project-debug-target, project-run-target): Deleted. (ede-generic-get-configuration, ede-generic-setup-configuration) (ede-commit-project, project-rescan) (ede-generic-project::ede-customize) (ede-generic-target::ede-customize) (ede-generic-config::eieio-done-customizing) (ede-generic-config::ede-commit): Deleted. Subsumed by new baseclass. (ede-preprocessor-map, ede-system-include-path) (project-debug-target, project-run-target): Call new `ede-config-get-configuration' instead of old version. (ede-generic-load): Do not add to global list here. * ede/files.el (ede-find-project-root) (ede-files-find-existing) (ede-directory-get-toplevel-open-project-new): Deleted. (ede-project-root-directory): Use `ede-project-root' first. (ede-project-directory-remove-hash) (ede--directory-project-from-hash) (ede--directory-project-add-description-to-hash): Rename to make internal symbols (via --). Expand input dir first. (ede-directory-project-p): Doc fix (note obsoleted.) (ede-toplevel-project-or-nil): Alias to `ede-toplevel-project'. (ede-toplevel-project): Doc Fix. Delete commented out old code. Simplify returning result from ede-detect-directory-for-project. (ede-directory-get-open-project): Support when inodes are disabled. If disabled to str compare on root project. (ede-directory-get-toplevel-open-project): Enabled nested projects. When doing directory name matching, save the 'short' version of an answer (non-exact match) and eventually select the shortest answer at the end. Expand the filename of tested projects. Better support for when inodes are disabled. Add 'exact' option so that it will return a project that is an exact match. (ede-find-subproject-for-directory): Small optimization to run `file-truename' less often. (ede-directory-project-p): Move content, then use `ede-directory-project-cons'. Use `ede-detect-directory-for-project', replacing old detection loop. (ede-directory-project-cons): New, from above. (ede-toplevel-project): Toss old scanning code. Use `ede-detect-directory-for-project' instead. (ede-directory-get-toplevel-open-project-new): New. * ede/linux.el (ede-linux-project-root): Deleted. (ede-project-autoload): Remove dirmatch entry - it is no longer needed. * lisp/cedet/ede/proj.el (project-rescan): Replace direct manipulation of `ede-projects' with equivalent and better functions. (ede-proj-load): Replace call to test if dir has project to explicity ask filesystem if Project.ede is there. * ede/config.el: * ede/detect.el: New files. * ede/project-am.el (project-run-target): Add "./" to program to run for systems where '.' isn't in PATH. (project-am-load): Remove old code regarding `ede-constructing'. Just read in the makefiles. * ede/linux.el (ede-linux-load): Do not add to global list here. Don't check for existing anymore. (project-rescan): New. (ede-linux-project-list, ede-linux-file-existing): Deleted. (ede-linux-project-root): Delete body. Need symbol for autoloads for now. (ede-linux-project): No longer instance tracker. (ede-project-autoload): Don't provide :proj-root * ede/emacs.el (ede-emacs-load): Do not add project to global list here. Don't look for existing first. (ede-project-autoload): Remove dirmatch entry - it is no longer needed. Don't provide proj-root anymore. (ede-emacs-project-list, ede-emacs-file-existing): Delete. (ede-emacs-project-root): Remove body (need symbol for loaddefs still). (ede-emacs-project): Do not instance track anymore. * ede/cpp-root.el (initialize-instance): Remove commented code. Add note about why we are adding the project to the master list. Make sure if we are replacing a prev version, remove from global list. (ede-cpp-root-file-existing) (ede-cpp-root-project-file-for-dir) (ede-cpp-root-count, ede-cpp-root-project-root, ede-cpp-root-load) (ede-project-autoload cpp-root): Deleted. (ede-project-root-directory): Return :directory instead of calculating from :file. (project-rescan): New. * ede/base.el (ede-toplevel): Only use buffer cached value if subproj not passed in. * srecode/java.el (srecode-semantic-handle-:java): Fix case when an EDE project didn't support java paths. * lisp/cedet/ede/proj-elisp.el (ede-proj-target-elisp::ede-proj-tweak-autoconf): Kill buffer after saving modified elisp-comp script, as to avoid "file has changed on disk; really edit the buffer" questions when script gets rewritten. * emacs-lisp/eieio-custom.el (eieio-customize-object): Set eieio-cog (current group) to g, which is an improved form of input group. * srecode/doc-cpp.srt (mode): Set to c mode so this works with both C and C++.
-rw-r--r--admin/ChangeLog25
-rw-r--r--admin/grammars/c.by9
-rw-r--r--admin/grammars/scheme.by38
-rw-r--r--etc/ChangeLog5
-rw-r--r--etc/srecode/doc-cpp.srt2
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/cedet/ChangeLog251
-rw-r--r--lisp/cedet/cedet-global.el13
-rw-r--r--lisp/cedet/ede.el245
-rw-r--r--lisp/cedet/ede/auto.el182
-rw-r--r--lisp/cedet/ede/autoconf-edit.el1
-rw-r--r--lisp/cedet/ede/base.el2
-rw-r--r--lisp/cedet/ede/config.el416
-rw-r--r--lisp/cedet/ede/cpp-root.el110
-rw-r--r--lisp/cedet/ede/detect.el210
-rw-r--r--lisp/cedet/ede/emacs.el66
-rw-r--r--lisp/cedet/ede/files.el322
-rw-r--r--lisp/cedet/ede/generic.el278
-rw-r--r--lisp/cedet/ede/linux.el83
-rw-r--r--lisp/cedet/ede/pconf.el5
-rw-r--r--lisp/cedet/ede/proj-elisp.el3
-rw-r--r--lisp/cedet/ede/proj.el7
-rw-r--r--lisp/cedet/ede/project-am.el10
-rw-r--r--lisp/cedet/ede/shell.el13
-rw-r--r--lisp/cedet/semantic.el71
-rw-r--r--lisp/cedet/semantic/analyze.el121
-rw-r--r--lisp/cedet/semantic/analyze/complete.el12
-rw-r--r--lisp/cedet/semantic/bovine/c.el10
-rw-r--r--lisp/cedet/semantic/bovine/grammar.el19
-rw-r--r--lisp/cedet/semantic/bovine/scm.el2
-rw-r--r--lisp/cedet/semantic/db.el12
-rw-r--r--lisp/cedet/semantic/debug.el13
-rw-r--r--lisp/cedet/semantic/doc.el3
-rw-r--r--lisp/cedet/semantic/symref.el202
-rw-r--r--lisp/cedet/srecode/java.el9
-rw-r--r--lisp/emacs-lisp/eieio-custom.el2
-rw-r--r--lisp/emacs-lisp/eieio.el2
37 files changed, 1863 insertions, 917 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 303da8c020..e85c21a6cf 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,28 @@
+2014-11-09 Eric Ludlam <zappo@gnu.org>
+
+ * grammars/c.by (template-type): Add :template-specifier and
+ :typevar to capture extra details about the template.
+ (opt-post-fcn-modifiers): Splice in the found symbol into the
+ return value correctly.
+ (QUESTION): New punctuation.
+ (expression): Add ternary conditional support.
+
+ * grammars/scheme.by (MODULE): New token.
+ (scheme): Handle expanding the MODULE tag.
+ (scheme-list): Remove closeparen required match.
+ (scheme-in-list): Remove extraneous matches for DEFINE. Add
+ support for MODULE Simplify matching for code & make work.
+ (name-args, name-arg-list, name-arg-expand): Make it work.
+
+2014-11-09 David Engster <dengste@eml.cc>
+
+ * lisp/cedet/sematic/bovine/c.by
+ (opt-brackets-after-symbol): New.
+ (multi-stage-dereference): Use it. Add rules for explicit
+ matching the last dereference. We cannot just juse
+ 'namespace-symbol' as a single rule, since this would match too
+ greedy and mess with parsing default values of variables.
+
2014-11-09 Glenn Morris <rgm@gnu.org>
* admin.el (make-manuals-dist-output-variables)
diff --git a/admin/grammars/c.by b/admin/grammars/c.by
index 0fd8a33f25..f601549093 100644
--- a/admin/grammars/c.by
+++ b/admin/grammars/c.by
@@ -64,6 +64,7 @@
%token <punctuation> PLUS "\\`[+]\\'"
%token <punctuation> MINUS "\\`[-]\\'"
%token <punctuation> BANG "\\`[!]\\'"
+%token <punctuation> QUESTION "\\`[?]\\'"
%token <punctuation> EQUAL "\\`[=]\\'"
%token <punctuation> LESS "\\`[<]\\'"
%token <punctuation> GREATER "\\`[>]\\'"
@@ -590,10 +591,12 @@ template-type
| declmods typeformbase cv-declmods opt-stars
opt-ref variablearg-opt-name
(TYPE-TAG (car $2) nil nil nil
+ :template-specifier (plist-get (nth 2 $2) :template-specifier)
:constant-flag (if (member "const" (append $1 $3)) t nil)
:typemodifiers (delete "const" (append $1 $3))
:reference (car ,$5)
:pointer (car $4)
+ :typevar (car $6)
)
;
@@ -832,7 +835,7 @@ opt-initializers
opt-post-fcn-modifiers
: post-fcn-modifiers opt-post-fcn-modifiers
- ( ,(cons ,$1 $2) )
+ ( ,(cons ,(car $1) $2) )
| ;;EMPTY
( nil )
;
@@ -1206,7 +1209,9 @@ expr-binop
;; Use expression for parsing only. Don't actually return anything
;; for now. Hopefully we can fix this later.
expression
- : unaryexpression expr-binop unaryexpression
+ : unaryexpression QUESTION unaryexpression COLON unaryexpression
+ ( (identity start) (identity end) )
+ | unaryexpression expr-binop unaryexpression
( (identity start) (identity end) )
| unaryexpression
( (identity start) (identity end) )
diff --git a/admin/grammars/scheme.by b/admin/grammars/scheme.by
index cceec0914f..16b67a3db4 100644
--- a/admin/grammars/scheme.by
+++ b/admin/grammars/scheme.by
@@ -25,6 +25,7 @@
%token DEFINE "define"
%token DEFINE-MODULE "define-module"
+%token MODULE "module"
%token LOAD "load"
%put DEFINE summary "Function: (define symbol expression)"
@@ -37,36 +38,50 @@
%%
scheme : semantic-list
- (EXPAND $1 scheme-list)
+ ( ,(let ((expand (EXPAND $1 scheme-list)))
+ (cond
+ ((semantic-tag-of-class-p expand 'module)
+ (TYPE-TAG (semantic-tag-name expand)
+ "module"
+ (EXPANDFULL $1 scheme)
+ nil) ;; Module contains more definitions like a type
+ )
+ (t
+ expand))))
;
-scheme-list : OPENPAREN scheme-in-list CLOSEPAREN
+scheme-list : OPENPAREN scheme-in-list
( ,$2 )
;
+
scheme-in-list: DEFINE symbol expression
(VARIABLE-TAG $2 nil $3 )
- | DEFINE name-args opt-doc sequence
+ | DEFINE name-args opt-doc
(FUNCTION-TAG (car ,$2) nil (cdr ,$2) )
| DEFINE-MODULE name-args
(PACKAGE-TAG (nth (length $2) $2 ) nil)
+ | MODULE symbol
+ (TAG $1 'module :members nil)
| LOAD string
(INCLUDE-TAG (file-name-nondirectory (read $2)) (read $2) )
- | symbol
+ | symbol sequence
(CODE-TAG $1 nil)
;
name-args: semantic-list
- (EXPAND $1 name-arg-expand)
+ (EXPAND $1 name-arg-list)
;
-name-arg-expand : open-paren name-arg-expand
+name-arg-list : OPENPAREN name-arg-expand
( ,$2 )
- | symbol name-arg-expand
- ( ,(cons $1 ,$2) )
- | ;; EMPTY
- ( )
- ;
+ ;
+
+name-arg-expand: symbol name-arg-expand
+ ( ,(cons $1 ,$2) )
+ | ;; EMPTY
+ ( )
+ ;
opt-doc : string
| ;; EMPTY
@@ -83,3 +98,4 @@ expression : symbol
;
;;; scheme.by ends here
+
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 876d99dbef..c46b103be2 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-09 Eric Ludlam <zappo@gnu.org>
+
+ * srecode/doc-cpp.srt (mode): Set to c mode so this works with
+ both C and C++.
+
2014-11-05 Teodor Zlatanov <tzz@lifelogs.com>
* NEWS: Mention `url-user-agent'. (Bug#16498)
diff --git a/etc/srecode/doc-cpp.srt b/etc/srecode/doc-cpp.srt
index 520f3f7d8c..60f0947082 100644
--- a/etc/srecode/doc-cpp.srt
+++ b/etc/srecode/doc-cpp.srt
@@ -19,7 +19,7 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-set mode "c++-mode"
+set mode "c-mode"
set application "document"
context declaration
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c8fc508681..a01dadad70 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-09 Eric Ludlam <zappo@gnu.org>
+
+ * emacs-lisp/eieio-custom.el (eieio-customize-object): Set
+ eieio-cog (current group) to g, which is an improved form of input
+ group.
+
2014-11-09 Juri Linkov <juri@jurta.org>
* isearch.el (isearch-message-prefix): Show "Multi-file" and
diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog
index 8e911cfe6d..d797132dd3 100644
--- a/lisp/cedet/ChangeLog
+++ b/lisp/cedet/ChangeLog
@@ -1,3 +1,254 @@
+2014-11-09 Eric Ludlam <zappo@gnu.org>
+
+ * semantic.el (semantic-mode): Add/remove 3
+ completion-at-point-functions.
+ (semantic-completion-at-point-function): Removed.
+ (semantic-analyze-completion-at-point-function)
+ (semantic-analyze-notc-completion-at-point-function)
+ (semantic-analyze-nolongprefix-completion-at-point-function): New
+ completion at point functions.
+
+ * semantic/doc.el (semantic-doc-snarf-comment-for-tag): Fix case
+ when comment-end is empty string.
+
+ * semantic/debug.el
+ (semantic-debug-parser-debugger-source): New buffer local
+ variable.
+ (semantic-debug-interface): Add 'nil' initform to overlays.
+ (semantic-debug-mode): Remove read-only tags from buffers on exit.
+ (semantic-debug): Add autoload cookie. Force the language
+ specific debugger to load.
+
+ * semantic/db.el (generic::semanticdb-full-filename): New generic
+ method to allow this method to be used on buffer names via an
+ associated database.
+
+ * semantic/symref.el
+ (semantic-symref-cleanup-recent-buffers-fcn): When cleaning up
+ buffers, don't clean up buffers that are being used (i.e., in a
+ window) when the hook fires.
+ (semantic-symref-recently-opened-buffers): New tracking variable.
+ (semantic-symref-cleanup-recent-buffers-fcn): New hook fcn.
+ (semantic-symref-result-get-tags): Move logic into
+ `semantic-symref-hit-to-tag-via-buffer', and cleanup buffers via
+ the symref cleanup function in post-command-hook.
+ (semantic-symref-hit-to-tag-via-buffer): Logic that used to be
+ from above.
+ (semantic-symref-hit-to-tag-via-db): New.
+
+ * semantic/analyze.el:
+ (semantic-analyze-find-tag-sequence-default): If first entry in
+ sequence is the only one, apply tagclass filter.
+ (semantic-analyze-princ-sequence): Show slot even if empty.
+ (semantic-analyze-find-tag-sequence)
+ (semantic-analyze-find-tag-sequence-default): Add flags argument.
+ Add support for forcing the final entry of the sequence to be of
+ class variable.
+ (semantic-analyze-find-tag): Fix bug where input class filter was
+ ignored if there was a typecache match.
+ (semantic-analyze-current-context-default): For assignments, the
+ assignee now must be of class variable.
+
+ * semantic/analyze/complete.el
+ (semantic-analyze-possible-completions-default): Add
+ 'no-longprefix' flag. When used, the prefix and prefixtypes are
+ shortened to just the last symbol.
+
+ * semantic/bovine/c.el (semantic-c-do-lex-if): Catch errors from
+ 'hideif', and push to the parser warning stack.
+ (semantic-lex-cpp-define): When a comment is at the end of a
+ macro, do not subtract an extra 1 from the found position. Fixes
+ bug with: #define foo (a)/**/ adding an extra ')' to the stream.
+
+ * semantic/bovine/scm.el (semantic-lex-scheme-symbol): Allow
+ symbols to be one char long.
+
+ * semantic/bovine/grammar.el
+ (bovine-grammar-calculate-source-on-path): New.
+ (bovine-grammar-setupcode-builder): Use it.
+
+ * ede.el (ede/detect): New require.
+ (ede-version): Bump version
+ (ede-initialize-state-current-buffer): Use new
+ `ede-detect-directory-for-project' to detect projects first
+ instead of depending on currente dir only.
+ (ede-delete-project-from-global-list): New.
+ (ede-flush-deleted-projects): Use above.
+ (ede-check-project-query-fcn): New variable
+ (ede-check-project-directory): Use above when querying the user.
+ Added to support unit testing of this security measure.
+ (ede-initialize-state-current-buffer): Use
+ `ede-directory-project-cons' instead of the -detect- fcn to take
+ advantage of the cache. Pass found project into
+ `ede-load-project-file'.
+ (ede-load-project-file): Add new input DETECTIN.
+ (ede-rescan-toplevel): Get the proj root a better way.
+ (ede-load-project-file): Return the loaded object. When asking
+ for existing project, ask for an exact match.
+ (ede-initialize-state-current-buffer): Simplify some conditional
+ logic.
+ (ede-load-project-file): Simplify conditional logic.
+ (ede-global-list-sanity-check): New Testing fcn.
+ (ede-parent-project): Replace old code with call to faster
+ `ede-find-subproject-for-directory'.
+ (ede-load-project-file): Use
+ `ede-directory-get-toplevel-open-project' instead of above
+ deleted. Rename "pfc" to "autoloader". Use
+ `ede-directory-project-cons' to detect a project. Delete no
+ project found case where we search up the tree.
+
+ * ede/auto.el (ede-project-autoload): Fix doc typo. Add
+ `:root-only' slot.
+ (ede-auto-load-project): Doc update: warn to not use.
+ (ede-dir-to-projectfile): Deleted.
+ (ede-project-autoload-dirmatch): Add subdir-only slot. Make
+ configdatastash unbound by default.
+ (ede-do-dirmatch): If subdir-only is true, then don't allow exact
+ matches. Account for configdatastash as unbound. Assume value of
+ nil means no tool installed. Make sure loaded path matches from
+ beginning. Stash the regexp, not the raw string.
+ (ede-project-class-files): Note that makefile and automake are not
+ root only.
+ (ede-auto-detect-in-dir): New (for use with `ede/detect.el').
+ (ede-project-dirmatch-p): Deleted.
+ (ede-project-root-directory): Remove body, return nil.
+ (ede-project-autoload): :proj-root-dirmatch can be null & doc fix.
+ (ede-auto-detect-in-dir): If there is no :proj-file, check for a
+ dirmatch.
+
+ * ede/generic.el (ede/config): Replace require of ede.
+ (ede-generic-new-autoloader): Generic projects are now safe by
+ default. Note this is NOT a root only project.
+ (project-rescan, ede-project-root, ede-generic-target-java)
+ (ede-java-classpath, ede-find-subproject-for-directory): New.
+ (ede-enable-generic-projects): Add new autoloaders for git, bzr,
+ hg, sv, CVS.
+ (ede-generic-vc-project)
+ (ede-generic-vc-project::ede-generic-setup-configuration): New.
+ (ede-generic-config): Remove slots: c-include-path,
+ c-preprocessor-table, c-preprocessor-files, classpath,
+ build-command, debug-command, run command. Inherit from
+ ede-extra-config-build, ede-extra-config-program. Make
+ run-command :value match :custom so only strings are accepted.
+ Add some more :group slot specifiers.
+ (ede-generic-project): Add mixins `ede-project-with-config-c' and
+ `ede-project-with-config-java'. Inherit from
+ `ede-project-with-config-build',
+ `ede-project-with-config-program'. Subclass
+ `ede-project-with-config'. Remove duplication from new baseclass.
+ (ede-generic-target): Inherit from `ede-target-with-config-build',
+ `ede-target-with-config-program'. Subclass `ede-target-with-config'.
+ (ede-generic-target-c-cpp): Add mixin `ede-target-with-config-c'.
+ (ede-generic-target-java): Add mixin `ede-target-with-config-java'.
+ (ede-preprocessor-map, ede-system-include-path)
+ (edejava-classpath): Deleted, moved to config.el.
+ (project-compile-project, project-compile-target)
+ (project-debug-target, project-run-target): Deleted.
+ (ede-generic-get-configuration, ede-generic-setup-configuration)
+ (ede-commit-project, project-rescan)
+ (ede-generic-project::ede-customize)
+ (ede-generic-target::ede-customize)
+ (ede-generic-config::eieio-done-customizing)
+ (ede-generic-config::ede-commit): Deleted. Subsumed by new
+ baseclass.
+ (ede-preprocessor-map, ede-system-include-path)
+ (project-debug-target, project-run-target): Call new
+ `ede-config-get-configuration' instead of old version.
+ (ede-generic-load): Do not add to global list here.
+
+ * ede/files.el (ede-find-project-root)
+ (ede-files-find-existing)
+ (ede-directory-get-toplevel-open-project-new): Deleted.
+ (ede-project-root-directory): Use `ede-project-root' first.
+ (ede-project-directory-remove-hash)
+ (ede--directory-project-from-hash)
+ (ede--directory-project-add-description-to-hash): Rename to make
+ internal symbols (via --). Expand input dir first.
+ (ede-directory-project-p): Doc fix (note obsoleted.)
+ (ede-toplevel-project-or-nil): Alias to `ede-toplevel-project'.
+ (ede-toplevel-project): Doc Fix. Delete commented out old code.
+ Simplify returning result from ede-detect-directory-for-project.
+ (ede-directory-get-open-project): Support when
+ inodes are disabled. If disabled to str compare on root project.
+ (ede-directory-get-toplevel-open-project): Enabled nested
+ projects. When doing directory name matching, save the 'short'
+ version of an answer (non-exact match) and eventually select the
+ shortest answer at the end. Expand the filename of tested
+ projects. Better support for when inodes are disabled. Add
+ 'exact' option so that it will return a project that is an exact
+ match.
+ (ede-find-subproject-for-directory): Small optimization to run
+ `file-truename' less often.
+ (ede-directory-project-p): Move content, then use
+ `ede-directory-project-cons'. Use
+ `ede-detect-directory-for-project', replacing old detection loop.
+ (ede-directory-project-cons): New, from above.
+ (ede-toplevel-project): Toss old scanning code. Use
+ `ede-detect-directory-for-project' instead.
+ (ede-directory-get-toplevel-open-project-new): New.
+
+ * ede/linux.el (ede-linux-project-root): Deleted.
+ (ede-project-autoload): Remove dirmatch entry - it is no longer
+ needed.
+
+ * lisp/cedet/ede/proj.el (project-rescan): Replace direct
+ manipulation of `ede-projects' with equivalent and better
+ functions.
+ (ede-proj-load): Replace call to test if dir has project to
+ explicity ask filesystem if Project.ede is there.
+
+ * ede/config.el:
+ * ede/detect.el: New files.
+
+ * ede/project-am.el (project-run-target): Add "./" to program to
+ run for systems where '.' isn't in PATH.
+ (project-am-load): Remove old code regarding `ede-constructing'.
+ Just read in the makefiles.
+
+ * ede/linux.el (ede-linux-load): Do not add to global list here.
+ Don't check for existing anymore.
+ (project-rescan): New.
+ (ede-linux-project-list, ede-linux-file-existing): Deleted.
+ (ede-linux-project-root): Delete body. Need symbol for autoloads
+ for now.
+ (ede-linux-project): No longer instance tracker.
+ (ede-project-autoload): Don't provide :proj-root
+
+ * ede/emacs.el (ede-emacs-load): Do not add project to global list
+ here. Don't look for existing first.
+ (ede-project-autoload): Remove dirmatch entry - it is no longer
+ needed. Don't provide proj-root anymore.
+ (ede-emacs-project-list, ede-emacs-file-existing): Delete.
+ (ede-emacs-project-root): Remove body (need symbol for loaddefs
+ still).
+ (ede-emacs-project): Do not instance track anymore.
+
+ * ede/cpp-root.el (initialize-instance): Remove commented code.
+ Add note about why we are adding the project to the master list.
+ Make sure if we are replacing a prev version, remove from global
+ list.
+ (ede-cpp-root-file-existing)
+ (ede-cpp-root-project-file-for-dir)
+ (ede-cpp-root-count, ede-cpp-root-project-root, ede-cpp-root-load)
+ (ede-project-autoload cpp-root): Deleted.
+ (ede-project-root-directory): Return :directory instead of
+ calculating from :file.
+ (project-rescan): New.
+
+ * ede/base.el (ede-toplevel): Only use buffer cached value if
+ subproj not passed in.
+
+ * srecode/java.el (srecode-semantic-handle-:java): Fix case when
+ an EDE project didn't support java paths.
+
+2014-11-09 David Engster <dengste@eml.cc>
+
+ * lisp/cedet/ede/proj-elisp.el
+ (ede-proj-target-elisp::ede-proj-tweak-autoconf): Kill buffer
+ after saving modified elisp-comp script, as to avoid "file has
+ changed on disk; really edit the buffer" questions when script
+ gets rewritten.
+
2014-10-29 Paul Eggert <eggert@cs.ucla.edu>
Simplify use of current-time and friends.
diff --git a/lisp/cedet/cedet-global.el b/lisp/cedet/cedet-global.el
index ee1b5ce7cc..494c41b0ef 100644
--- a/lisp/cedet/cedet-global.el
+++ b/lisp/cedet/cedet-global.el
@@ -93,6 +93,13 @@ SCOPE is the scope of the search, such as 'project or 'subdirs."
(apply 'call-process cedet-global-gtags-command
nil b nil
flags)
+
+ ;; Check for warnings.
+ (with-current-buffer b
+ (goto-char (point-min))
+ (when (re-search-forward "Error\\|Warning" nil t)
+ (error "Output:\n%S" (buffer-string))))
+
b))
(defun cedet-gnu-global-expand-filename (filename)
@@ -181,8 +188,10 @@ If a database already exists, then just update it."
(let ((default-directory dir))
(cedet-gnu-global-gtags-call
(when root
- '("-i");; Incremental update flag.
- )))))
+ '("-u");; Incremental update flag.
+ ))
+ )
+ ))
(provide 'cedet-global)
diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el
index a9a53d776e..55dff1ac44 100644
--- a/lisp/cedet/ede.el
+++ b/lisp/cedet/ede.el
@@ -45,6 +45,7 @@
(require 'ede/source)
(require 'ede/base)
(require 'ede/auto)
+(require 'ede/detect)
(eval-and-compile
(load "ede/loaddefs" nil 'nomessage))
@@ -61,7 +62,7 @@
(declare-function ede-up-directory "ede/files")
(declare-function semantic-lex-make-spp-table "semantic/lex-spp")
-(defconst ede-version "1.2"
+(defconst ede-version "2.0"
"Current version of the Emacs EDE.")
;;; Code:
@@ -500,42 +501,50 @@ Sets buffer local variables for EDE."
;; Init the buffer.
(let* ((ROOT nil)
(proj (ede-directory-get-open-project default-directory
- 'ROOT))
- (projauto nil))
-
- (when (or proj ROOT
- ;; If there is no open project, look up the project
- ;; autoloader to see if we should initialize.
- (setq projauto (ede-directory-project-p default-directory t)))
-
- (when (and (not proj) projauto)
-
- ;; No project was loaded, but we have a project description
- ;; object. This means that we can check if it is a safe
- ;; project to load before requesting it to be loaded.
-
- (when (or (oref projauto safe-p)
- ;; The project style is not safe, so check if it is
- ;; in `ede-project-directories'.
- (let ((top (ede-toplevel-project default-directory)))
- (ede-directory-safe-p top)))
-
- ;; The project is safe, so load it in.
- (setq proj (ede-load-project-file default-directory 'ROOT))))
-
- ;; Only initialize EDE state in this buffer if we found a project.
- (when proj
-
- (setq ede-object (ede-buffer-object (current-buffer)
+ 'ROOT)))
+
+ (when (not proj)
+ ;; If there is no open project, look up the project
+ ;; autoloader to see if we should initialize.
+ (let ((projdetect (ede-directory-project-cons default-directory)))
+
+ (when projdetect
+ ;; No project was loaded, but we have a project description
+ ;; object. This means that we try to load it.
+ ;;
+ ;; Before loading, we need to check if it is a safe
+ ;; project to load before requesting it to be loaded.
+
+ (when (or (oref (cdr projdetect) safe-p)
+ ;; The project style is not safe, so check if it is
+ ;; in `ede-project-directories'.
+ (let ((top (car projdetect)))
+ (ede-directory-safe-p top)))
+
+ ;; The project is safe, so load it in.
+ (setq proj (ede-load-project-file default-directory projdetect 'ROOT))))))
+
+ ;; If PROJ is now loaded in, we can initialize our buffer to it.
+ (when proj
+
+ ;; ede-object represents the specific EDE related class that best
+ ;; represents this buffer. It could be a project (for a project file)
+ ;; or a target. Also save off ede-object-project, the project that
+ ;; the buffer belongs to for the case where ede-object is a target.
+ (setq ede-object (ede-buffer-object (current-buffer)
'ede-object-project))
- (setq ede-object-root-project
- (or ROOT (ede-project-root ede-object-project)))
+ ;; Every project has a root. It might be the same as ede-object.
+ ;; Cache that also as the root is a very common thing to need.
+ (setq ede-object-root-project
+ (or ROOT (ede-project-root ede-object-project)))
- (if (and (not ede-object) ede-object-project)
- (ede-auto-add-to-target))
+ ;; Check to see if we want to add this buffer to a target.
+ (if (and (not ede-object) ede-object-project)
+ (ede-auto-add-to-target))
- (ede-apply-target-options)))))
+ ;; Apply any options from the found target.
+ (ede-apply-target-options))))
(defun ede-reset-all-buffers ()
"Reset all the buffers due to change in EDE."
@@ -679,6 +688,7 @@ Otherwise, create a new project for DIR."
(if (ede-check-project-directory dir)
(progn
;; Load the project in DIR, or make one.
+ ;; @TODO - IS THIS REAL?
(ede-load-project-file dir)
;; Check if we loaded anything on the previous line.
@@ -700,6 +710,10 @@ Otherwise, create a new project for DIR."
(error "%s is not an allowed project directory in `ede-project-directories'"
dir)))
+(defvar ede-check-project-query-fcn 'y-or-n-p
+ "Function used to ask the user if they want to permit a project to load.
+This is abstracted out so that tests can answer this question.")
+
(defun ede-check-project-directory (dir)
"Check if DIR should be in `ede-project-directories'.
If it is not, try asking the user if it should be added; if so,
@@ -712,9 +726,10 @@ Return nil if DIR should not be in `ede-project-directories'."
;; If `ede-project-directories' is a list, maybe add it.
(when (listp ede-project-directories)
(or (member dir ede-project-directories)
- (when (y-or-n-p (format "`%s' is not listed in `ede-project-directories'.
+ (when (funcall ede-check-project-query-fcn
+ (format "`%s' is not listed in `ede-project-directories'.
Add it to the list of allowed project directories? "
- dir))
+ dir))
(push dir ede-project-directories)
;; If possible, save `ede-project-directories'.
(if (or custom-file user-init-file)
@@ -782,7 +797,9 @@ Optional argument NAME is the name to give this project."
(error
"Unknown file name specifier %S"
pf)))
- :targets nil)))
+ :targets nil)
+
+ ))
(inits (oref obj initializers)))
;; Force the name to match for new objects.
(eieio-object-set-name-string nobj (oref nobj :name))
@@ -821,16 +838,17 @@ ARGS are additional arguments to pass to method SYM."
(defun ede-rescan-toplevel ()
"Rescan all project files."
(interactive)
- (if (not (ede-directory-get-open-project default-directory))
- ;; This directory isn't open. Can't rescan.
- (error "Attempt to rescan a project that isn't open")
+ (when (not (ede-toplevel))
+ ;; This directory isn't open. Can't rescan.
+ (error "Attempt to rescan a project that isn't open"))
- ;; Continue
- (let ((toppath (ede-toplevel-project default-directory))
- (ede-deep-rescan t))
+ ;; Continue
+ (let ((root (ede-toplevel))
+ (ede-deep-rescan t))
- (project-rescan (ede-load-project-file toppath))
- (ede-reset-all-buffers))))
+ (project-rescan root)
+ (ede-reset-all-buffers)
+ ))
(defun ede-new-target (&rest args)
"Create a new target specific to this type of project file.
@@ -918,6 +936,8 @@ Optional argument FORCE forces the file to be removed without asking."
(interactive)
(ede-invoke-method 'project-edit-file-target))
+;;; Compilation / Debug / Run
+;;
(defun ede-compile-project ()
"Compile the current project."
(interactive)
@@ -1063,6 +1083,10 @@ On success, return the added project."
(add-to-list 'ede-projects proj)
proj)
+(defun ede-delete-project-from-global-list (proj)
+ "Remove project PROJ from the master list of projects."
+ (setq ede-projects (remove proj ede-projects)))
+
(defun ede-flush-deleted-projects ()
"Scan the projects list for projects which no longer exist.
Flush the dead projects from the project cache."
@@ -1072,80 +1096,83 @@ Flush the dead projects from the project cache."
(when (not (file-exists-p (oref P :file)))
(add-to-list 'dead P)))
(dolist (D dead)
- (setq ede-projects (remove D ede-projects)))
+ (ede-delete-project-from-global-list D))
))
-(defun ede-load-project-file (dir &optional rootreturn)
+(defun ede-global-list-sanity-check ()
+ "Perform a sanity check to make sure there are no duplicate projects."
+ (interactive)
+ (let ((scanned nil))
+ (dolist (P ede-projects)
+ (if (member (oref P :directory) scanned)
+ (error "Duplicate project (by dir) found in %s!" (oref P :directory))
+ (push (oref P :directory) scanned)))
+ (unless ede--disable-inode
+ (setq scanned nil)
+ (dolist (P ede-projects)
+ (if (member (ede--project-inode P) scanned)
+ (error "Duplicate project (by inode) found in %s!" (ede--project-inode P))
+ (push (ede--project-inode P) scanned))))
+ (message "EDE by directory %sis still sane." (if ede--disable-inode "" "& inode "))))
+
+(defun ede-load-project-file (dir &optional detectin rootreturn)
"Project file independent way to read a project in from DIR.
+Optional DETECTIN is an autoload cons from `ede-detect-directory-for-project'
+which can be passed in to save time.
Optional ROOTRETURN will return the root project for DIR."
- ;; Only load if something new is going on. Flush the dirhash.
- (ede-project-directory-remove-hash dir)
- ;; Do the load
- ;;(message "EDE LOAD : %S" file)
- (let* ((file dir)
- (path (file-name-as-directory (expand-file-name dir)))
- (pfc (ede-directory-project-p path))
- (toppath nil)
- (o nil))
- (cond
- ((not pfc)
- ;; @TODO - Do we really need to scan? Is this a waste of time?
- ;; Scan upward for a the next project file style.
- (let ((p path))
- (while (and p (not (ede-directory-project-p p)))
- (setq p (ede-up-directory p)))
- (if p (ede-load-project-file p)
- nil)
- ;; recomment as we go
- ;;nil
- ))
- ;; Do nothing if we are building an EDE project already.
- (ede-constructing
- nil)
- ;; Load in the project in question.
- (t
- (setq toppath (ede-toplevel-project path))
- ;; We found the top-most directory. Check to see if we already
- ;; have an object defining its project.
- (setq pfc (ede-directory-project-p toppath t))
-
- ;; See if it's been loaded before
- (setq o (object-assoc (ede-dir-to-projectfile pfc toppath) 'file
- ede-projects))
-
- ;; If not open yet, load it.
- (unless o
- (let ((ede-constructing pfc))
- (setq o (ede-auto-load-project pfc toppath))))
-
- ;; Return the found root project.
- (when rootreturn (set rootreturn o))
-
- (let (tocheck found)
- ;; Now find the project file belonging to FILE!
- (setq tocheck (list o))
- (setq file (ede-dir-to-projectfile pfc (expand-file-name path)))
- (while (and tocheck (not found))
- (let ((newbits nil))
- (when (car tocheck)
- (if (string= file (oref (car tocheck) file))
- (setq found (car tocheck)))
- (setq newbits (oref (car tocheck) subproj)))
- (setq tocheck
- (append (cdr tocheck) newbits))))
- (if (not found)
- (message "No project for %s, but passes project-p test" file)
- ;; Now that the file has been reset inside the project object, do
- ;; the cache maintenance.
- (setq ede-project-cache-files
- (delete (oref found file) ede-project-cache-files)))
- found)))))
+ ;; Don't do anything if we are in the process of
+ ;; constructing an EDE object.
+ ;;
+ ;; Prevent recursion.
+ (unless ede-constructing
+
+ ;; Only load if something new is going on. Flush the dirhash.
+ (ede-project-directory-remove-hash dir)
+
+ ;; Do the load
+ ;;(message "EDE LOAD : %S" file)
+ (let* ((file dir)
+ (path (file-name-as-directory (expand-file-name dir)))
+ (detect (or detectin (ede-directory-project-cons path)))
+ (autoloader nil)
+ (toppath nil)
+ (o nil))
+
+ (when detect
+ (setq toppath (car detect))
+ (setq autoloader (cdr detect))
+
+ ;; See if it's been loaded before. Use exact matching since
+ ;; know that 'toppath' is the root of the project.
+ (setq o (ede-directory-get-toplevel-open-project toppath 'exact))
+
+ ;; If not open yet, load it.
+ (unless o
+ ;; NOTE: We set ede-constructing to the autoloader we are using.
+ ;; Some project types have one class, but many autoloaders
+ ;; and this is how we tell the instantiation which kind of
+ ;; project to make.
+ (let ((ede-constructing autoloader))
+
+ ;; This is the only place `ede-auto-load-project' should be called.
+
+ (setq o (ede-auto-load-project autoloader toppath))))
+
+ ;; Return the found root project.
+ (when rootreturn (set rootreturn o))
+
+ ;; The project has been found (in the global list) or loaded from
+ ;; disk (via autoloader.) We can now search for the project asked
+ ;; for from DIR in the sub-list.
+ (ede-find-subproject-for-directory o path)
+
+ ;; Return the project.
+ o))))
;;; PROJECT ASSOCIATIONS
;;
;; Moving between relative projects. Associating between buffers and
;; projects.
-
(defun ede-parent-project (&optional obj)
"Return the project belonging to the parent directory.
Return nil if there is no previous directory.
diff --git a/lisp/cedet/ede/auto.el b/lisp/cedet/ede/auto.el
index 337cd77b4e..63e0504689 100644
--- a/lisp/cedet/ede/auto.el
+++ b/lisp/cedet/ede/auto.el
@@ -47,8 +47,13 @@
:initform nil
:documentation
"An index into the match-data of `configregex'.")
- (configdatastash :initform nil
- :documentation
+ (subdir-only :initarg :subdir-only
+ :initform t
+ :documentation
+ "Non-nil means an exact match to the found directory is a non-match.
+This implies projects exist only in subdirectories of the configuration path.
+If `:subdir-only' is nil, then the directory from the configuration file is the project.")
+ (configdatastash :documentation
"Save discovered match string.")
)
"Support complex matches for projects that live in named directories.
@@ -80,8 +85,11 @@ into memory.")
;; If the thing to match is stored in a config file.
((stringp fc)
(when (file-exists-p fc)
- (let ((matchstring (oref dirmatch configdatastash)))
- (unless matchstring
+ (let ((matchstring
+ (if (slot-boundp dirmatch 'configdatastash)
+ (oref dirmatch configdatastash)
+ nil)))
+ (when (and (not matchstring) (not (slot-boundp dirmatch 'configdatastash)))
(save-current-buffer
(let* ((buff (get-file-buffer fc))
(readbuff
@@ -94,12 +102,27 @@ into memory.")
(setq matchstring
(match-string (or (oref dirmatch configregexidx) 0)))))
(if (not buff) (kill-buffer readbuff))))
- ;; Save what we find in our cache.
- (oset dirmatch configdatastash matchstring))
+ (when matchstring
+ ;; If this dirmatch only finds subdirs of matchstring, then
+ ;; force matchstring to be a directory.
+ (when (oref dirmatch subdir-only)
+ (setq matchstring (file-name-as-directory matchstring)))
+ ;; Convert matchstring to a regexp
+ (setq matchstring (concat "^" (regexp-quote matchstring)))
+ ;; Stash it for later.
+ (oset dirmatch configdatastash matchstring))
+ ;; Debug
+ ;;(message "Stashing config data for dirmatch %S as %S" (eieio-object-name dirmatch) matchstring)
+ )
+ ;;(message "dirmatch %s against %s" matchstring (expand-file-name file))
;; Match against our discovered string
- (and matchstring (string-match (regexp-quote matchstring) file))
+ (setq file (file-name-as-directory (expand-file-name file)))
+ (and matchstring (string-match matchstring (expand-file-name file))
+ (or (not (oref dirmatch subdir-only))
+ (not (= (match-end 0) (length file))))
+ )
)))
-
+
;; Add new matches here
;; ((stringp somenewslot ...)
;; )
@@ -119,13 +142,21 @@ into memory.")
:documentation "The lisp file belonging to this class.")
(proj-file :initarg :proj-file
:documentation "Name of a project file of this type.")
+ (root-only :initarg :root-only
+ :initform t ;; Default - majority case.
+ :documentation
+ "Non-nil if project detection only finds proj-file @ project root.")
(proj-root-dirmatch :initarg :proj-root-dirmatch
- :initform ""
- :type (or string ede-project-autoload-dirmatch)
+ :initform nil
+ :type (or null string ede-project-autoload-dirmatch)
:documentation
"To avoid loading a project, check if the directory matches this.
-For projects that use directory name matches, a function would load that project.
-Specifying this matcher will allow EDE to check without loading the project.")
+Specifying this matcher object will allow EDE to perform a complex
+check without loading the project.
+
+NOTE: If you use dirmatch, you may need to set :root-only to `nil'.
+While it may be a root based project, all subdirs will happen to return
+true for the dirmatch, so for scanning purposes, set it to `nil'.")
(proj-root :initarg :proj-root
:type function
:documentation "A function symbol to call for the project root.
@@ -168,12 +199,14 @@ type is required and the load function used.")
(ede-project-autoload "edeproject-makefile"
:name "Make" :file 'ede/proj
:proj-file "Project.ede"
+ :root-only nil
:load-type 'ede-proj-load
:class-sym 'ede-proj-project
:safe-p nil)
(ede-project-autoload "edeproject-automake"
:name "Automake" :file 'ede/proj
:proj-file "Project.ede"
+ :root-only nil
:initializers '(:makefile-type Makefile.am)
:load-type 'ede-proj-load
:class-sym 'ede-proj-project
@@ -181,6 +214,7 @@ type is required and the load function used.")
(ede-project-autoload "automake"
:name "automake" :file 'ede/project-am
:proj-file "Makefile.am"
+ :root-only nil
:load-type 'project-am-load
:class-sym 'project-am-makefile
:new-p nil
@@ -233,97 +267,33 @@ added. Possible values are:
;; Splice into the list.
(setcdr prev (cons projauto next))))))))
-;;; EDE project-autoload methods
+;;; Project Autoload Methods
;;
-(defmethod ede-project-root ((this ede-project-autoload))
- "If a project knows its root, return it here.
-Allows for one-project-object-for-a-tree type systems."
- nil)
-
-(defun ede-project-dirmatch-p (file dirmatch)
- "Return non-nil if FILE matches DIRMATCH.
-DIRMATCH could be nil (no match), a string (regexp match),
-or an `ede-project-autoload-dirmatch' object."
- ;; If dirmatch is a string, then we simply match it against
- ;; the file we are testing.
- (if (stringp dirmatch)
- (string-match dirmatch file)
- ;; if dirmatch is instead a dirmatch object, we test against
- ;; that object instead.
- (if (ede-project-autoload-dirmatch-p dirmatch)
- (ede-do-dirmatch dirmatch file)
- (error "Unknown project directory match type."))
- ))
-(defmethod ede-project-root-directory ((this ede-project-autoload)
- &optional file)
- "If a project knows its root, return it here.
-Allows for one-project-object-for-a-tree type systems.
-Optional FILE is the file to test. If there is no FILE, use
-the current buffer."
- (when (not file)
- (setq file default-directory))
- (when (slot-boundp this :proj-root)
- (let ((dirmatch (oref this proj-root-dirmatch))
- (rootfcn (oref this proj-root))
- (callfcn t))
- (when rootfcn
- (if ;; If the dirmatch (an object) is not installed, then we
- ;; always skip doing a match.
- (and (ede-project-autoload-dirmatch-p dirmatch)
- (not (ede-dirmatch-installed dirmatch)))
- (setq callfcn nil)
- ;; Other types of dirmatch:
- (when (and
- ;; If the Emacs Lisp file handling this project hasn't
- ;; been loaded, we will use the quick dirmatch feature.
- (not (featurep (oref this file)))
- ;; If the dirmatch is an empty string, then we always
- ;; skip doing a match.
- (not (and (stringp dirmatch) (string= dirmatch "")))
- )
- ;; If this file DOES NOT match dirmatch, we set the callfcn
- ;; to nil, meaning don't load the ede support file for this
- ;; type of project. If it does match, we will load the file
- ;; and use a more accurate programmatic match from there.
- (unless (ede-project-dirmatch-p file dirmatch)
- (setq callfcn nil))))
- ;; Call into the project support file for a match.
- (when callfcn
- (condition-case nil
- (funcall rootfcn file)
- (error
- (funcall rootfcn))))
- ))))
-
-(defmethod ede-dir-to-projectfile ((this ede-project-autoload) dir)
- "Return a full file name of project THIS found in DIR.
-Return nil if the project file does not exist."
+;; New method using detect.el
+(defmethod ede-auto-detect-in-dir ((this ede-project-autoload) dir)
+ "Return non-nil if THIS project autoload is found in DIR."
(let* ((d (file-name-as-directory dir))
- (root (ede-project-root-directory this d))
(pf (oref this proj-file))
- (dm (oref this proj-root-dirmatch))
- (f (cond ((stringp pf)
- (expand-file-name pf (or root d)))
- ((and (symbolp pf) (fboundp pf))
- ;; If there is a symbol to call, lets make extra
- ;; sure we really can call it without loading in
- ;; other EDE projects. This happens if the file is
- ;; already loaded, or if there is a dirmatch, but
- ;; root is empty.
- (when (and (featurep (oref this file))
- (or (not (stringp dm))
- (not (string= dm "")))
- root)
- (funcall pf (or root d))))))
- )
- (when (and f (file-exists-p f))
- f)))
+ (f (when (stringp pf) (expand-file-name pf d))))
+ (if f
+ (and f (file-exists-p f))
+ (let ((dirmatch (oref this proj-root-dirmatch)))
+ (cond
+ ((stringp dirmatch)
+ nil) ; <- do something here - maybe obsolete the option?
+ ((ede-project-autoload-dirmatch-p dirmatch)
+ (if (and dirmatch (ede-dirmatch-installed dirmatch))
+ (ede-do-dirmatch dirmatch dir)
+ ;(message "Dirmatch %S not installed." dirmatch)
+ )))))))
(defmethod ede-auto-load-project ((this ede-project-autoload) dir)
"Load in the project associated with THIS project autoload description.
THIS project description should be valid for DIR, where the project will
-be loaded."
+be loaded.
+
+NOTE: Do not call this - it should only be called from `ede-load-project-file'."
;; Last line of defense: don't load unsafe projects.
(when (not (or (oref this :safe-p)
(ede-directory-safe-p dir)))
@@ -332,7 +302,27 @@ be loaded."
(let ((o (funcall (oref this load-type) dir)))
(when (not o)
(error "Project type error: :load-type failed to create a project"))
- (ede-add-project-to-global-list o)))
+ (ede-add-project-to-global-list o)
+ ;; @TODO - Add to hash over at `ede-inode-directory-hash'.
+ ))
+
+
+
+
+
+
+;;; -------- Old Methods
+;; See if we can do without them.
+
+;; @FIXME - delete from loaddefs to remove this.
+(defmethod ede-project-root ((this ede-project-autoload))
+ "If a project knows its root, return it here.
+Allows for one-project-object-for-a-tree type systems."
+ nil)
+
+;; @FIXME - delete from loaddefs to remove this.
+(defmethod ede-project-root-directory ((this ede-project-autoload) &optional file)
+ "" nil)
(provide 'ede/auto)
diff --git a/lisp/cedet/ede/autoconf-edit.el b/lisp/cedet/ede/autoconf-edit.el
index 3ac6949fbb..0e829def56 100644
--- a/lisp/cedet/ede/autoconf-edit.el
+++ b/lisp/cedet/ede/autoconf-edit.el
@@ -60,6 +60,7 @@ configure the initial configure script using `autoconf-new-automake-string'"
(defvar autoconf-preferred-macro-order
'("AC_INIT"
+ "AC_CONFIG_SRCDIR"
"AM_INIT_AUTOMAKE"
"AM_CONFIG_HEADER"
;; Arg parsing
diff --git a/lisp/cedet/ede/base.el b/lisp/cedet/ede/base.el
index 283f9dccac..4183ff4c61 100644
--- a/lisp/cedet/ede/base.el
+++ b/lisp/cedet/ede/base.el
@@ -605,7 +605,7 @@ Display the results as a debug list."
"Return the ede project which is the root of the current project.
Optional argument SUBPROJ indicates a subproject to start from
instead of the current project."
- (or ede-object-root-project
+ (or (when (not subproj) ede-object-root-project)
(let* ((cp (or subproj (ede-current-project))))
(or (and cp (ede-project-root cp))
(progn
diff --git a/lisp/cedet/ede/config.el b/lisp/cedet/ede/config.el
new file mode 100644
index 0000000000..3ac3c06f33
--- /dev/null
+++ b/lisp/cedet/ede/config.el
@@ -0,0 +1,416 @@
+;;; ede/config.el --- Configuration Handler baseclass
+
+;; Copyright (C) 2014 Free Software Foundation, Inc.
+
+;; Author: Eric Ludlam <eric@siege-engine.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; Some auto-detecting projects (such as the 'generic' project type)
+;; can be enhanced by also saving a configuration file that is EDE
+;; specific. EDE will be able to load that configuration from the save
+;; file as a way of augmenting what is normally already detected.
+;;
+;; How To Use:
+;;
+;; Subclass `ede-extra-config', and add the features you want to use.
+;; Several mixins are available for adding in C++ or Java support. Bring
+;; in the pieces you need.
+;;
+;; Your project and targets should all have a common baseclass from
+;; `ede-project-with-config' or `ede-target-with-config'. When
+;; subclassing the project, be sure to override the class allocated
+;; slots for the `config-class'. This will tie your new project to
+;; the new configuration type.
+;;
+;; You can also override the file name used to save the configuration
+;; object in.
+;;
+;; If you need to take special action in `project-rescan' be sure to also
+;; call `call-next-method' to also get the configuration rescanned.
+;;
+;; Note on config file safety:
+;;
+;; Normally an EDE project that loads a save file should have it's
+;; autoload slot :safe-p set to nil. Projects who save data via
+;; config.el can mark their project as :safe-p t. The config system will
+;; do the queries needed to protect the user. This allows a generic
+;; project to become active in cases where no save file exists, nor is
+;; needed.
+
+;;; Code:
+(require 'ede)
+
+;;; CONFIG
+;;
+;; This is the base of a configuration class supported by the
+;; `ede-project-with-config' baseclass.
+;;
+(defclass ede-extra-config (eieio-persistent)
+ ((extension :initform ".ede")
+ (file-header-line :initform ";; EDE Project Configuration")
+ (project :type ede-project-with-config-child
+ :documentation
+ "The project this config is bound to.")
+ (ignored-file :initform nil
+ :type (or null symbol)
+ :documentation
+ "Set to non-nil if this was created and an on-disk file
+was ignored. Use this to warn the user that they might want to load in
+an on-disk version.")
+ )
+ "Baseclass for auxilliary configuration files for EDE.
+This should be subclassed by projects that auto detect a project
+and also want to save some extra level of configuration.")
+
+;;; PROJECT BASECLASS
+;;
+;; Subclass this baseclass if you want your EDE project to also
+;; support saving an extra configuration file of unique data
+;; needed for this project.
+;;
+(defclass ede-project-with-config (ede-project)
+ ((menu :initform nil)
+ (config-file-basename
+ :initform "Config.ede"
+ :allocation :class
+ :type string
+ :documentation
+ "The filename to use for saving the configuration.
+This filename excludes the directory name and is used to
+initalize the :file slot of the persistent baseclass.")
+ (config-class
+ :initform ede-extra-config
+ :allocation :class
+ :type class
+ :documentation
+ "The class of the configuration used by this project.")
+ (config :initform nil
+ :type (or null ede-extra-config-child)
+ :documentation
+ "The configuration object for this project.")
+ )
+ "Baseclass for projects that save a configuration.")
+
+(defclass ede-target-with-config (ede-target)
+ ()
+ "Baseclass for targetes of classes that use a config object.")
+
+;;; Rescanning
+
+(defmethod project-rescan ((this ede-project-with-config))
+ "Rescan this generic project from the sources."
+ ;; Force the config to be rescanned.
+ (oset this config nil)
+ ;; Ask if it is safe to load the config from disk.
+ (ede-config-get-configuration this t)
+ )
+
+;;; Project Methods for configuration
+
+(defmethod ede-config-get-configuration ((proj ede-project-with-config) &optional loadask)
+ "Return the configuration for the project PROJ.
+If optional LOADASK is non-nil, then if a project file exists, and if
+the directory isn't on the `safe' list, ask to add it to the safe list."
+ (let ((config (oref proj config)))
+
+ ;; If the request is coming at a time when we want to ask the user,
+ ;; and there already is a configuration, AND the last time we ignored
+ ;; the on-file version we did so automatically (without asking) then
+ ;; in theory there are NO mods to this config, and we should re-ask,
+ ;; and possibly re-load.
+ (when (and loadask config (eq (oref config ignored-file) 'auto))
+ (setq config nil))
+
+ (when (not config)
+ (let* ((top (oref proj :directory))
+ (fname (expand-file-name (oref proj config-file-basename) top))
+ (class (oref proj config-class))
+ (ignore-type nil))
+ (if (and (file-exists-p fname)
+ (or (ede-directory-safe-p top)
+ ;; Only force the load if someone asked.
+ (and loadask (ede-check-project-directory top))))
+ ;; Load in the configuration
+ (setq config (eieio-persistent-read fname class))
+ ;; If someone said not to load stuff from here then
+ ;; pop up a warning.
+ (when (file-exists-p fname)
+ (message "Ignoring EDE config file for now and creating a new one. Use C-c . g to load it.")
+ ;; Set how it was ignored.
+ (if loadask
+ (setq ignore-type 'manual)
+ (setq ignore-type 'auto))
+ )
+ ;; Create a new one.
+ (setq config (make-instance class
+ "Configuration"
+ :file fname))
+ (oset config ignored-file ignore-type)
+
+ ;; Set initial values based on project.
+ (ede-config-setup-configuration proj config))
+ ;; Link things together.
+ (oset proj config config)
+ (oset config project proj)))
+ config))
+
+(defmethod ede-config-setup-configuration ((proj ede-project-with-config) config)
+ "Default configuration setup method."
+ nil)
+
+(defmethod ede-commit-project ((proj ede-project-with-config))
+ "Commit any change to PROJ to its file."
+ (let ((config (ede-config-get-configuration proj)))
+ (ede-commit config)))
+
+;;; Customization
+;;
+(defmethod ede-customize ((proj ede-project-with-config))
+ "Customize the EDE project PROJ by actually configuring the config object."
+ (let ((config (ede-config-get-configuration proj t)))
+ (eieio-customize-object config)))
+
+(defmethod ede-customize ((target ede-target-with-config))
+ "Customize the EDE TARGET by actually configuring the config object."
+ ;; Nothing unique for the targets, use the project.
+ (ede-customize-project))
+
+(defmethod eieio-done-customizing ((config ede-extra-config))
+ "Called when EIEIO is done customizing the configuration object.
+We need to go back through the old buffers, and update them with
+the new configuration."
+ (ede-commit config)
+ ;; Loop over all the open buffers, and re-apply.
+ (ede-map-targets
+ (oref config project)
+ (lambda (target)
+ (ede-map-target-buffers
+ target
+ (lambda (b)
+ (with-current-buffer b
+ (ede-apply-target-options)))))))
+
+(defmethod ede-commit ((config ede-extra-config))
+ "Commit all changes to the configuration to disk."
+ ;; So long as the user is trying to safe this config, make sure they can
+ ;; get at it again later.
+ (let ((dir (file-name-directory (oref config file))))
+ (ede-check-project-directory dir))
+
+ (eieio-persistent-save config))
+
+;;; PROJECT MIXINS
+;;
+;; These are project part mixins. Use multiple inheritence for each
+;; piece of these configuration optiosn you would like to have as part
+;; of your project.
+
+;;; PROGRAM
+;; If there is a program that can be run or debugged that is unknown
+;; and needs to be configured.
+(defclass ede-extra-config-program ()
+ ((debug-command :initarg :debug-command
+ :initform "gdb "
+ :type string
+ :group commands
+ :custom string
+ :group (default build)
+ :documentation
+ "Command used for debugging this project.")
+ (run-command :initarg :run-command
+ :initform ""
+ :type string
+ :group commands
+ :custom string
+ :group (default build)
+ :documentation
+ "Command used to run something related to this project."))
+ "Class to mix into a configuration for debug/run of programs.")
+
+(defclass ede-project-with-config-program ()
+ ()
+ "Class to mix into a project with configuration for programs.")
+
+(defclass ede-target-with-config-program ()
+ ()
+ "Class to mix into a project with configuration for programs.
+This class brings in method overloads for running and debugging
+programs from a project.")
+
+(defmethod project-debug-target ((target ede-target-with-config-program))
+ "Run the current project derived from TARGET in a debugger."
+ (let* ((proj (ede-target-parent target))
+ (config (ede-config-get-configuration proj t))
+ (debug (oref config :debug-command))
+ (cmd (read-from-minibuffer
+ "Debug Command: "
+ debug))
+ (cmdsplit (split-string cmd " " t))
+ ;; @TODO - this depends on the user always typing in something good
+ ;; like "gdb" or "dbx" which also exists as a useful Emacs command.
+ ;; Is there a better way?
+ (cmdsym (intern-soft (car cmdsplit))))
+ (call-interactively cmdsym t)))
+
+(defmethod project-run-target ((target ede-target-with-config-program))
+ "Run the current project derived from TARGET."
+ (let* ((proj (ede-target-parent target))
+ (config (ede-config-get-configuration proj t))
+ (run (concat "./" (oref config :run-command)))
+ (cmd (read-from-minibuffer "Run (like this): " run)))
+ (ede-shell-run-something target cmd)))
+
+;;; BUILD
+;; If the build style is unknown and needs to be configured.
+(defclass ede-extra-config-build ()
+ ((build-command :initarg :build-command
+ :initform "make -k"
+ :type string
+ :group commands
+ :custom string
+ :group (default build)
+ :documentation
+ "Command used for building this project."))
+ "Class to mix into a configuration for compilation.")
+
+(defclass ede-project-with-config-build ()
+ ()
+ "Class to mix into a project with configuration for builds.
+This class brings in method overloads for building.")
+
+(defclass ede-target-with-config-build ()
+ ()
+ "Class to mix into a project with configuration for builds.
+This class brings in method overloads for for building.")
+
+(defmethod project-compile-project ((proj ede-project-with-config-build) &optional command)
+ "Compile the entire current project PROJ.
+Argument COMMAND is the command to use when compiling."
+ (let* ((config (ede-config-get-configuration proj t))
+ (comp (oref config :build-command)))
+ (compile comp)))
+
+(defmethod project-compile-target ((obj ede-target-with-config-build) &optional command)
+ "Compile the current target OBJ.
+Argument COMMAND is the command to use for compiling the target."
+ (project-compile-project (ede-current-project) command))
+
+;;; C / C++
+;; Configure includes and preprocessor symbols for C/C++ needed by
+;; Semantic.
+(defclass ede-extra-config-c ()
+ ((c-include-path :initarg :c-include-path
+ :initform nil
+ :type list
+ :custom (repeat (string :tag "Path"))
+ :group c
+ :documentation
+ "The include path used by C/C++ projects.
+The include path is used when searching for symbols.")
+ (c-preprocessor-table :initarg :c-preprocessor-table
+ :initform nil
+ :type list
+ :custom (repeat (cons (string :tag "Macro")
+ (string :tag "Value")))
+ :group c
+ :documentation
+ "Preprocessor Symbols for this project.
+When files within this project are parsed by CEDET, these symbols will be
+used to resolve macro occurrences in source fies.
+If you modify this slot, you will need to force your source files to be
+parsed again.")
+ (c-preprocessor-files :initarg :c-preprocessor-files
+ :initform nil
+ :type list
+ :group c
+ :custom (repeat (string :tag "Include File"))
+ :documentation
+ "Files parsed and used to populate preprocessor tables.
+When files within this project are parsed by CEDET, these symbols will be used to
+resolve macro occurences in source files.
+If you modify this slot, you will need to force your source files to be
+parsed again."))
+ "Class to mix into a configuration for compilation.")
+
+(defclass ede-project-with-config-c ()
+ ()
+ "Class to mix into a project for C/C++ support.")
+
+(defclass ede-target-with-config-c ()
+ ()
+ "Class to mix into a project for C/C++ support.
+This target brings in methods used by Semantic to query
+the preprocessor map, and include paths.")
+
+(defmethod ede-preprocessor-map ((this ede-target-with-config-c))
+ "Get the pre-processor map for some generic C code."
+ (let* ((proj (ede-target-parent this))
+ (root (ede-project-root proj))
+ (config (ede-config-get-configuration proj))
+ filemap
+ )
+ ;; Preprocessor files
+ (dolist (G (oref config :c-preprocessor-files))
+ (let ((table (semanticdb-file-table-object
+ (ede-expand-filename root G))))
+ (when table
+ (when (semanticdb-needs-refresh-p table)
+ (semanticdb-refresh-table table))
+ (setq filemap (append filemap (oref table lexical-table)))
+ )))
+ ;; The core table
+ (setq filemap (append filemap (oref config :c-preprocessor-table)))
+
+ filemap
+ ))
+
+(defmethod ede-system-include-path ((this ede-target-with-config-c))
+ "Get the system include path used by project THIS."
+ (let* ((proj (ede-target-parent this))
+ (config (ede-config-get-configuration proj)))
+ (oref config c-include-path)))
+
+;;; Java
+;; Configuration needed for programming with Java.
+(defclass ede-extra-config-java ()
+ ()
+ "Class to mix into a configuration for compilation.")
+
+(defclass ede-project-with-config-java ()
+ ()
+ "Class to mix into a project to support java.
+This brings in methods to support Semantic querying the
+java class path.")
+
+(defclass ede-target-with-config-java ()
+ ()
+ "Class to mix into a project to support java.")
+
+(defmethod ede-java-classpath ((proj ede-project-with-config-java))
+ "Return the classpath for this project."
+ (oref (ede-config-get-configuration proj) :classpath))
+
+;; Local variables:
+;; generated-autoload-file: "loaddefs.el"
+;; generated-autoload-load-name: "ede/config"
+;; End:
+
+(provide 'ede/config)
+
+;;; ede/config.el ends here
diff --git a/lisp/cedet/ede/cpp-root.el b/lisp/cedet/ede/cpp-root.el
index bf5c8257c9..7ea92364f2 100644
--- a/lisp/cedet/ede/cpp-root.el
+++ b/lisp/cedet/ede/cpp-root.el
@@ -116,11 +116,6 @@
;; <write your code here, or return nil>
;; )
;;
-;; (defun MY-ROOT-FCN ()
-;; "Return the root directory for `default-directory'"
-;; ;; You might be able to use `ede-cpp-root-project-root'.
-;; )
-;;
;; (defun MY-LOAD (dir)
;; "Load a project of type `cpp-root' for the directory DIR.
;; Return nil if there isn't one."
@@ -128,16 +123,14 @@
;; :locate-fcn 'MYFCN)
;; )
;;
-;; (add-to-list 'ede-project-class-files
-;; (ede-project-autoload "cpp-root"
+;; (ede-add-project-autoload
+;; (ede-project-autoload "cpp-root"
;; :name "CPP ROOT"
;; :file 'ede/cpp-root
;; :proj-file 'MY-FILE-FOR-DIR
-;; :proj-root 'MY-ROOT-FCN
;; :load-type 'MY-LOAD
;; :class-sym 'ede-cpp-root-project
-;; :safe-p t)
-;; t)
+;; :safe-p t))
;;
;;; TODO
;;
@@ -168,91 +161,13 @@
;;; PROJECT CACHE:
;;
-;; cpp-root projects are created in a .emacs or other config file, but
-;; there still needs to be a way for a particular file to be
-;; identified against it. The cache is where we look to map a file
-;; against a project.
-;;
-;; Setting up a simple in-memory cache of active projects allows the
-;; user to re-load their configuration file several times without
-;; messing up the active project set.
+;; cpp-root projects are created in a .emacs or other config file. We
+;; need to cache them so if the user re-loads a lisp file with the
+;; config in it, we can flush out the old one and replace it.
;;
(defvar ede-cpp-root-project-list nil
"List of projects created by option `ede-cpp-root-project'.")
-(defun ede-cpp-root-file-existing (dir)
- "Find a cpp-root project in the list of cpp-root projects.
-DIR is the directory to search from."
- (let ((projs ede-cpp-root-project-list)
- (ans nil))
- (while (and projs (not ans))
- (let ((root (ede-project-root-directory (car projs))))
- (when (string-match (concat "^" (regexp-quote root)) dir)
- (setq ans (car projs))))
- (setq projs (cdr projs)))
- ans))
-
-;;; PROJECT AUTOLOAD CONFIG
-;;
-;; Each project type registers itself into the project-class list.
-;; This way, each time a file is loaded, EDE can map that file to a
-;; project. This project type checks files against the internal cache
-;; of projects created by the user.
-;;
-;; EDE asks two kinds of questions. One is, does this DIR belong to a
-;; project. If it does, it then asks, what is the ROOT directory to
-;; the project in DIR. This is easy for cpp-root projects, but more
-;; complex for multiply nested projects.
-;;
-;; If EDE finds out that a project exists for DIR, it then loads that
-;; project. The LOAD routine can either create a new project object
-;; (if it needs to load it off disk) or more likely can return an
-;; existing object for the discovered directory. cpp-root always uses
-;; the second case.
-
-(defun ede-cpp-root-project-file-for-dir (&optional dir)
- "Return a full file name to the project file stored in DIR."
- (let ((proj (ede-cpp-root-file-existing dir)))
- (when proj (oref proj :file))))
-
-(defvar ede-cpp-root-count 0
- "Count number of hits to the cpp root thing.
-This is a debugging variable to test various optimizations in file
-lookup in the main EDE logic.")
-
-;;;###autoload
-(defun ede-cpp-root-project-root (&optional dir)
- "Get the root directory for DIR."
- (let ((projfile (ede-cpp-root-project-file-for-dir
- (or dir default-directory))))
- (setq ede-cpp-root-count (1+ ede-cpp-root-count))
- ;(debug)
- (when projfile
- (file-name-directory projfile))))
-
-(defun ede-cpp-root-load (dir &optional rootproj)
- "Return a CPP root object if you created one.
-Return nil if there isn't one.
-Argument DIR is the directory it is created for.
-ROOTPROJ is nil, since there is only one project."
- ;; Snoop through our master list.
- (ede-cpp-root-file-existing dir))
-
-;;;###autoload
-(ede-add-project-autoload
- (ede-project-autoload "cpp-root"
- :name "CPP ROOT"
- :file 'ede/cpp-root
- :proj-file 'ede-cpp-root-project-file-for-dir
- :proj-root 'ede-cpp-root-project-root
- :load-type 'ede-cpp-root-load
- :class-sym 'ede-cpp-root-project
- :new-p nil
- :safe-p t)
- ;; When a user creates one of these, it should override any other project
- ;; type that might happen to be in this directory, so force this to the
- ;; very front.
- 'unique)
;;; CLASSES
;;
@@ -372,6 +287,7 @@ Each directory needs a project file to control it.")
:directory 'ede-cpp-root-project-list)))
;; This is safe, because :directory isn't filled in till later.
(when (and old (not (eq old this)))
+ (ede-delete-project-from-global-list old)
(delete-instance old)))
;; Basic initialization.
(when (or (not (file-exists-p f))
@@ -381,11 +297,13 @@ Each directory needs a project file to control it.")
(oset this :file f)
(oset this :directory (file-name-directory f))
(ede-project-directory-remove-hash (file-name-directory f))
+ ;; NOTE: We must add to global list here because these classes are not
+ ;; created via the typial loader, but instead via calls from a .emacs
+ ;; file.
(ede-add-project-to-global-list this)
+
(unless (slot-boundp this 'targets)
(oset this :targets nil))
- ;; We need to add ourselves to the master list.
- ;;(setq ede-projects (cons this ede-projects))
))
;;; SUBPROJ Management.
@@ -465,7 +383,7 @@ This knows details about or source tree."
(defmethod ede-project-root-directory ((this ede-cpp-root-project))
"Return my root."
- (file-name-directory (oref this file)))
+ (oref this directory))
;;; C/CPP SPECIFIC CODE
;;
@@ -558,6 +476,10 @@ Argument COMMAND is the command to use for compiling the target."
(project-compile-project (oref obj :project) command)))
+(defmethod project-rescan ((this ede-cpp-root-project))
+ "Don't rescan this project from the sources."
+ (message "cpp-root has nothing to rescan."))
+
;;; Quick Hack
(defun ede-create-lots-of-projects-under-dir (dir projfile &rest attributes)
"Create a bunch of projects under directory DIR.
diff --git a/lisp/cedet/ede/detect.el b/lisp/cedet/ede/detect.el
new file mode 100644
index 0000000000..2b329185c8
--- /dev/null
+++ b/lisp/cedet/ede/detect.el
@@ -0,0 +1,210 @@
+;;; ede/detect.el --- EDE project detection and file associations
+
+;; Copyright (C) 2014 Free Software Foundation, Inc.
+
+;; Author: Eric M. Ludlam <eric@siege-engine.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; Project detection for EDE;
+;;
+;; Detection comes in multiple forms:
+;;
+;; `ede-detect-scan-directory-for-project' -
+;; Scan for a project via the file system.
+;; `ede-detect-directory-for-project' -
+;; Check our file cache for a project. If that failes, use
+;; the scan fcn above.
+
+;;; Code:
+
+(require 'ede/auto) ;; Autoload settings.
+
+(when (or (<= emacs-major-version 23)
+ ;; predicate as name added in Emacs 24.2
+ (and (= emacs-major-version 24)
+ (< emacs-minor-version 2)))
+ (message "Loading CEDET fallback autoload library.")
+ (require 'cedet/dominate
+ (expand-file-name "../../../etc/fallback-libraries/dominate.el"
+ (file-name-directory load-file-name))))
+
+
+;;; BASIC PROJECT SCAN
+;;
+(defun ede--detect-stop-scan-p (dir)
+ "Return non-nil if we need to stop scanning upward in DIR."
+ ;;(let ((stop
+ (file-exists-p (expand-file-name ".ede_stop_scan" dir)))
+;;)
+;;(when stop
+;;(message "Stop Scan at %s" dir))
+;;stop))
+
+(defvar ede--detect-found-project nil
+ "When searching for a project, temporarilly save that file.")
+
+(defun ede--detect-ldf-predicate (dir)
+ "Non-nil if DIR contain any known EDE project types."
+ (if (ede--detect-stop-scan-p dir)
+ (throw 'stopscan nil)
+ (let ((types ede-project-class-files))
+ ;; Loop over all types, loading in the first type that we find.
+ (while (and types (not ede--detect-found-project))
+ (if (ede-auto-detect-in-dir (car types) dir)
+ (progn
+ ;; We found one!
+ (setq ede--detect-found-project (car types)))
+ (setq types (cdr types)))
+ )
+ ede--detect-found-project)))
+
+(defun ede--detect-scan-directory-for-project (directory)
+ "Detect an EDE project for the current DIRECTORY by scanning.
+This function ALWAYS scans files and directories and DOES NOT
+use any file caches.
+Return a cons cell:
+ ( ROOTDIR . PROJECT-AUTOLOAD)"
+ (let* ((ede--detect-found-project nil)
+ (root
+ (catch 'stopscan
+ (locate-dominating-file directory
+ 'ede--detect-ldf-predicate))))
+ (when root
+ (cons root ede--detect-found-project))))
+
+;;; Root Only project detect
+;;
+;; For projects that only have a detectible ROOT file, but may in fact
+;; contain a generic file such as a Makefile, we need to do a second scan
+;; to make sure we don't miss-match.
+(defun ede--detect-ldf-rootonly-predicate (dir)
+ "Non-nil if DIR contain any known EDE project types."
+ (if (ede--detect-stop-scan-p dir)
+ (throw 'stopscan nil)
+ (let ((types ede-project-class-files))
+ ;; Loop over all types, loading in the first type that we find.
+ (while (and types (not ede--detect-found-project))
+ (if (and
+ (oref (car types) root-only)
+ (ede-auto-detect-in-dir (car types) dir))
+ (progn
+ ;; We found one!
+ (setq ede--detect-found-project (car types)))
+ (setq types (cdr types)))
+ )
+ ede--detect-found-project)))
+
+(defun ede--detect-scan-directory-for-rootonly-project (directory)
+ "Detect an EDE project for the current DIRECTORY by scanning.
+This function ALWAYS scans files and directories and DOES NOT
+use any file caches.
+Return a cons cell:
+ ( ROOTDIR . PROJECT-AUTOLOAD)"
+ (let* ((ede--detect-found-project nil)
+ (root
+ (catch 'stopscan
+ (locate-dominating-file directory
+ 'ede--detect-ldf-rootonly-predicate))))
+ (when root
+ (cons root ede--detect-found-project))))
+
+
+;;; NESTED PROJECT SCAN
+;;
+;; For projects that can have their dominating file exist in all their
+;; sub-directories as well.
+
+(defvar ede--detect-nomatch-auto nil
+ "An ede autoload that needs to be un-matched.")
+
+(defun ede--detect-ldf-root-predicate (dir)
+ "Non-nil if DIR no longer match `ede--detect-nomatch-auto'."
+ (or (ede--detect-stop-scan-p dir)
+ ;; To know if DIR is at the top, we need to look just above
+ ;; to see if there is a match.
+ (let ((updir (file-name-directory (directory-file-name dir))))
+ (if (equal updir dir)
+ ;; If it didn't change, then obviously this must be the top.
+ t
+ ;; If it is different, check updir for the file.
+ (not (ede-auto-detect-in-dir ede--detect-nomatch-auto updir))))))
+
+(defun ede--detect-scan-directory-for-project-root (directory auto)
+ "If DIRECTORY has already been detected with AUTO, find the root.
+Some projects have their dominating file in all their directories, such
+as Project.ede. In that case we will detect quickly, but then need
+to scan upward to find the topmost occurance of that file."
+ (let* ((ede--detect-nomatch-auto auto)
+ (root (locate-dominating-file directory
+ 'ede--detect-ldf-root-predicate)))
+ root))
+
+;;; TOP LEVEL SCAN
+;;
+;; This function for combining the above scans.
+(defun ede-detect-directory-for-project (directory)
+ "Detect an EDE project for the current DIRECTORY.
+Scan the filesystem for a project.
+Return a cons cell:
+ ( ROOTDIR . PROJECT-AUTOLOAD)"
+ (let* ((scan (ede--detect-scan-directory-for-project directory))
+ (root (car scan))
+ (auto (cdr scan)))
+ (when scan
+ ;; If what we found is already a root-only project, return it.
+ (if (oref auto root-only)
+ scan
+
+ ;; If what we found is a generic project, check to make sure we aren't
+ ;; in some other kind of root project.
+ (if (oref auto generic-p)
+ (let ((moreroot (ede--detect-scan-directory-for-rootonly-project root)))
+ ;; If we found a rootier project, return that.
+ (if moreroot
+ moreroot
+
+ ;; If we didn't find a root from the generic project, then
+ ;; we need to rescan upward.
+ (cons (ede--detect-scan-directory-for-project-root root auto) auto)))
+
+ ;; Non-generic non-root projects also need to rescan upward.
+ (cons (ede--detect-scan-directory-for-project-root root auto) auto)))
+
+ )))
+
+;;; TEST
+;;
+;; A quick interactive testing fcn.
+(defun ede-detect-qtest ()
+ "Run a quick test for autodetecting on BUFFER."
+ (interactive)
+ (let ((start (current-time))
+ (ans (ede-detect-directory-for-project default-directory))
+ (end (current-time)))
+ (if ans
+ (message "Project found in %d sec @ %s of type %s"
+ (float-time (time-subtract end start))
+ (car ans)
+ (eieio-object-name-string (cdr ans)))
+ (message "No Project found.") )))
+
+
+(provide 'ede/detect)
+
+;;; ede/detect.el ends here
diff --git a/lisp/cedet/ede/emacs.el b/lisp/cedet/ede/emacs.el
index 76925a6671..88df1d2963 100644
--- a/lisp/cedet/ede/emacs.el
+++ b/lisp/cedet/ede/emacs.el
@@ -38,37 +38,12 @@
(declare-function semanticdb-refresh-table "semantic/db")
;;; Code:
-(defvar ede-emacs-project-list nil
- "List of projects created by option `ede-emacs-project'.")
-
-(defun ede-emacs-file-existing (dir)
- "Find a Emacs project in the list of Emacs projects.
-DIR is the directory to search from."
- (let ((projs ede-emacs-project-list)
- (ans nil))
- (while (and projs (not ans))
- (let ((root (ede-project-root-directory (car projs))))
- (when (string-match (concat "^" (regexp-quote root))
- (file-name-as-directory dir))
- (setq ans (car projs))))
- (setq projs (cdr projs)))
- ans))
-;;;###autoload
+;; @TODO - get rid of this. Stuck in loaddefs right now.
+
(defun ede-emacs-project-root (&optional dir)
"Get the root directory for DIR."
- (when (not dir) (setq dir default-directory))
- (let ((case-fold-search t)
- (proj (ede-files-find-existing dir ede-emacs-project-list)))
- (if proj
- (ede-up-directory (file-name-directory
- (oref proj :file)))
- ;; No pre-existing project. Let's take a wild-guess if we have
- ;; an Emacs project here.
- (when (string-match "emacs[^/]*" dir)
- (let ((base (substring dir 0 (match-end 0))))
- (when (file-exists-p (expand-file-name "src/emacs.c" base))
- base))))))
+ nil)
(defun ede-emacs-version (dir)
"Find the Emacs version for the Emacs src in DIR.
@@ -118,8 +93,8 @@ m4_define(\\[SXEM4CS_BETA_VERSION\\], \\[\\([0-9]+\\)\\])")
;; Return a tuple
(cons emacs ver))))
-(defclass ede-emacs-project (ede-project eieio-instance-tracker)
- ((tracking-symbol :initform 'ede-emacs-project-list)
+(defclass ede-emacs-project (ede-project)
+ (
)
"Project Type for the Emacs source code."
:method-invocation-order :depth-first)
@@ -129,17 +104,15 @@ m4_define(\\[SXEM4CS_BETA_VERSION\\], \\[\\([0-9]+\\)\\])")
Return nil if there isn't one.
Argument DIR is the directory it is created for.
ROOTPROJ is nil, since there is only one project."
- (or (ede-files-find-existing dir ede-emacs-project-list)
- ;; Doesn't already exist, so let's make one.
- (let* ((vertuple (ede-emacs-version dir))
- (proj (ede-emacs-project
- (car vertuple)
- :name (car vertuple)
- :version (cdr vertuple)
- :directory (file-name-as-directory dir)
- :file (expand-file-name "src/emacs.c"
- dir))))
- (ede-add-project-to-global-list proj))))
+ ;; Doesn't already exist, so let's make one.
+ (let* ((vertuple (ede-emacs-version dir)))
+ (ede-emacs-project
+ (car vertuple)
+ :name (car vertuple)
+ :version (cdr vertuple)
+ :directory (file-name-as-directory dir)
+ :file (expand-file-name "src/emacs.c"
+ dir))))
;;;###autoload
(ede-add-project-autoload
@@ -147,8 +120,6 @@ ROOTPROJ is nil, since there is only one project."
:name "EMACS ROOT"
:file 'ede/emacs
:proj-file "src/emacs.c"
- :proj-root-dirmatch "emacs[^/]*"
- :proj-root 'ede-emacs-project-root
:load-type 'ede-emacs-load
:class-sym 'ede-emacs-project
:new-p nil
@@ -302,6 +273,15 @@ Knows about how the Emacs source tree is organized."
(ede-emacs-find-in-directories name dir dirs))
))
+;;; Command Support
+;;
+(defmethod project-rescan ((this ede-emacs-project))
+ "Rescan this Emacs project from the sources."
+ (let ((ver (ede-emacs-version (ede-project-root-directory this))))
+ (oset this name (car ver))
+ (oset this version (cdr ver))
+ ))
+
(provide 'ede/emacs)
;; Local variables:
diff --git a/lisp/cedet/ede/files.el b/lisp/cedet/ede/files.el
index ac245cf61b..1a97bfc4a5 100644
--- a/lisp/cedet/ede/files.el
+++ b/lisp/cedet/ede/files.el
@@ -80,46 +80,15 @@ Allows for one-project-object-for-a-tree type systems."
Allows for one-project-object-for-a-tree type systems.
Optional FILE is the file to test. It is ignored in preference
of the anchor file for the project."
- (file-name-directory (expand-file-name (oref this file))))
+ (let ((root (or (ede-project-root this) this)))
+ (file-name-directory (expand-file-name (oref this file)))))
-(defmethod ede--project-inode ((proj ede-project-placeholder))
- "Get the inode of the directory project PROJ is in."
- (if (slot-boundp proj 'dirinode)
- (oref proj dirinode)
- (oset proj dirinode (ede--inode-for-dir (oref proj :directory)))))
-
-(defmethod ede-find-subproject-for-directory ((proj ede-project-placeholder)
- dir)
- "Find a subproject of PROJ that corresponds to DIR."
- (if ede--disable-inode
- (let ((ans nil))
- ;; Try to find the right project w/out inodes.
- (ede-map-subprojects
- proj
- (lambda (SP)
- (when (not ans)
- (if (string= (file-truename dir) (oref SP :directory))
- (setq ans SP)
- (ede-find-subproject-for-directory SP dir)))))
- ans)
- ;; We can use inodes, so let's try it.
- (let ((ans nil)
- (inode (ede--inode-for-dir dir)))
- (ede-map-subprojects
- proj
- (lambda (SP)
- (when (not ans)
- (if (equal (ede--project-inode SP) inode)
- (setq ans SP)
- (setq ans (ede-find-subproject-for-directory SP dir))))))
- ans)))
+;; Why INODEs?
+;; An inode represents is a unique id that trancends symlinks, hardlinks, etc
+;; so when we cache an inode in a project, and hash directories to inodes, we
+;; can avoid costly filesystem queries and regex matches.
-;;; DIRECTORY IN OPEN PROJECT
-;;
-;; These routines match some directory name to one of the many pre-existing
-;; open projects. This should avoid hitting the disk, or asking lots of questions
-;; if used throughout the other routines.
(defvar ede-inode-directory-hash (make-hash-table
;; Note on test. Can we compare inodes or something?
:test 'equal)
@@ -147,6 +116,32 @@ of the anchor file for the project."
(ede--put-inode-dir-hash dir (nth 10 fattr))
)))))
+(defmethod ede--project-inode ((proj ede-project-placeholder))
+ "Get the inode of the directory project PROJ is in."
+ (if (slot-boundp proj 'dirinode)
+ (oref proj dirinode)
+ (oset proj dirinode (ede--inode-for-dir (oref proj :directory)))))
+
+(defun ede--inode-get-toplevel-open-project (inode)
+ "Return an already open toplevel project that is managing INODE.
+Does not check subprojects."
+ (when (or (and (numberp inode) (/= inode 0))
+ (consp inode))
+ (let ((all ede-projects)
+ (found nil)
+ )
+ (while (and all (not found))
+ (when (equal inode (ede--project-inode (car all)))
+ (setq found (car all)))
+ (setq all (cdr all)))
+ found)))
+
+;;; DIRECTORY IN OPEN PROJECT
+;;
+;; These routines match some directory name to one of the many pre-existing
+;; open projects. This should avoid hitting the disk, or asking lots of questions
+;; if used throughout the other routines.
+
(defun ede-directory-get-open-project (dir &optional rootreturn)
"Return an already open project that is managing DIR.
Optional ROOTRETURN specifies a symbol to set to the root project.
@@ -156,66 +151,105 @@ If DIR is the root project, then it is the same."
(proj (ede--inode-get-toplevel-open-project inode))
(ans nil))
;; Try file based search.
- (when (not proj)
+ (when (or ede--disable-inode (not proj))
(setq proj (ede-directory-get-toplevel-open-project ft)))
;; Default answer is this project
(setq ans proj)
;; Save.
(when rootreturn (set rootreturn proj))
;; Find subprojects.
- (when (and proj (or ede--disable-inode
- (not (equal inode (ede--project-inode proj)))))
+ (when (and proj (if ede--disable-inode
+ (not (string= ft (expand-file-name (oref proj :directory))))
+ (not (equal inode (ede--project-inode proj)))))
(setq ans (ede-find-subproject-for-directory proj ft)))
ans))
-(defun ede--inode-get-toplevel-open-project (inode)
- "Return an already open toplevel project that is managing INODE.
-Does not check subprojects."
- (when (or (and (numberp inode) (/= inode 0))
- (consp inode))
- (let ((all ede-projects)
- (found nil)
- )
- (while (and all (not found))
- (when (equal inode (ede--project-inode (car all)))
- (setq found (car all)))
- (setq all (cdr all)))
- found)))
-
-(defun ede-directory-get-toplevel-open-project (dir)
- "Return an already open toplevel project that is managing DIR."
+;; Force all users to switch to `ede-directory-get-open-project'
+;; for performance reasons.
+(defun ede-directory-get-toplevel-open-project (dir &optional exact)
+ "Return an already open toplevel project that is managing DIR.
+If optional EXACT is non-nil, only return exact matches for DIR."
(let ((ft (file-name-as-directory (expand-file-name dir)))
(all ede-projects)
- (ans nil))
+ (ans nil)
+ (shortans nil))
(while (and all (not ans))
;; Do the check.
- (let ((pd (oref (car all) :directory))
+ (let ((pd (expand-file-name (oref (car all) :directory)))
)
(cond
;; Exact text match.
((string= pd ft)
(setq ans (car all)))
;; Some sub-directory
- ((string-match (concat "^" (regexp-quote pd)) ft)
- (setq ans (car all)))
+ ((and (not exact) (string-match (concat "^" (regexp-quote pd)) ft))
+ (if (not shortans)
+ (setq shortans (car all))
+ ;; We already have a short answer, so see if pd (the match we found)
+ ;; is longer. If it is longer, then it is more precise.
+ (when (< (length (oref shortans :directory))
+ (length pd))
+ (setq shortans (car all))))
+ )
;; Exact inode match. Useful with symlinks or complex automounters.
- ((let ((pin (ede--project-inode (car all)))
- (inode (ede--inode-for-dir dir)))
- (and (not (eql pin 0)) (equal pin inode)))
- (setq ans (car all)))
+ ((and (not ede--disable-inode)
+ (let ((pin (ede--project-inode (car all)))
+ (inode (ede--inode-for-dir dir)))
+ (and (not (eql pin 0)) (equal pin inode))))
+ (setq ans (car all)))
;; Subdir via truename - slower by far, but faster than a traditional lookup.
- ((let ((ftn (file-truename ft))
- (ptd (file-truename (oref (car all) :directory))))
- (string-match (concat "^" (regexp-quote ptd)) ftn))
- (setq ans (car all)))
- ))
+ ;; Note that we must resort to truename in order to resolve issues such as
+ ;; cross-symlink projects.
+ ((and (not exact)
+ (let ((ftn (file-truename ft))
+ (ptd (file-truename pd)))
+ (string-match (concat "^" (regexp-quote ptd)) ftn)))
+ (if (not shortans)
+ (setq shortans (car all))
+ ;; We already have a short answer, so see if pd (the match we found)
+ ;; is longer. If it is longer, then it is more precise.
+ (when (< (length (expand-file-name (oref shortans :directory)))
+ (length pd))
+ (setq shortans (car all))))
+ )))
(setq all (cdr all)))
- ans))
+ ;; If we have an exact answer, use that, otherwise use
+ ;; the short answer we found -> ie - we are in a subproject.
+ (or ans shortans)))
+
+(defmethod ede-find-subproject-for-directory ((proj ede-project-placeholder)
+ dir)
+ "Find a subproject of PROJ that corresponds to DIR."
+ (if ede--disable-inode
+ (let ((ans nil)
+ (fulldir (file-truename dir)))
+ ;; Try to find the right project w/out inodes.
+ (ede-map-subprojects
+ proj
+ (lambda (SP)
+ (when (not ans)
+ (if (string= fulldir (file-truename (oref SP :directory)))
+ (setq ans SP)
+ (ede-find-subproject-for-directory SP dir)))))
+ ans)
+ ;; We can use inodes, so let's try it.
+ (let ((ans nil)
+ (inode (ede--inode-for-dir dir)))
+ (ede-map-subprojects
+ proj
+ (lambda (SP)
+ (when (not ans)
+ (if (equal (ede--project-inode SP) inode)
+ (setq ans SP)
+ (setq ans (ede-find-subproject-for-directory SP dir))))))
+ ans)))
-;;; DIRECTORY-PROJECT-P
+;;; DIRECTORY HASH
;;
-;; For a fresh buffer, or for a path w/ no open buffer, use this
-;; routine to determine if there is a known project type here.
+;; The directory hash matches expanded directory names to already detected
+;; projects. By hashing projects to directories, we can detect projects in
+;; places we have been before much more quickly.
+
(defvar ede-project-directory-hash (make-hash-table
;; Note on test. Can we compare inodes or something?
:test 'equal)
@@ -237,7 +271,7 @@ Do this only when developing new projects that are incorrectly putting
"Reset the directory hash for DIR.
Do this whenever a new project is created, as opposed to loaded."
;; TODO - Use maphash, and delete by regexp, not by dir searching!
-
+ (setq dir (expand-file-name dir))
(when (fboundp 'remhash)
(remhash (file-name-as-directory dir) ede-project-directory-hash)
;; Look for all subdirs of D, and remove them.
@@ -248,98 +282,95 @@ Do this whenever a new project is created, as opposed to loaded."
ede-project-directory-hash))
))
-(defun ede-directory-project-from-hash (dir)
+(defun ede--directory-project-from-hash (dir)
"If there is an already loaded project for DIR, return it from the hash."
(when (fboundp 'gethash)
+ (setq dir (expand-file-name dir))
(gethash dir ede-project-directory-hash nil)))
-(defun ede-directory-project-add-description-to-hash (dir desc)
+(defun ede--directory-project-add-description-to-hash (dir desc)
"Add to the EDE project hash DIR associated with DESC."
(when (fboundp 'puthash)
+ (setq dir (expand-file-name dir))
(puthash dir desc ede-project-directory-hash)
desc))
+;;; DIRECTORY-PROJECT-P, -CONS
+;;
+;; These routines are useful for detecting if a project exists
+;; in a provided directory.
+;;
+;; Note that -P provides less information than -CONS, so use -CONS
+;; instead so that -P can be obsoleted.
(defun ede-directory-project-p (dir &optional force)
- "Return a project description object if DIR has a project.
+ "Return a project description object if DIR is in a project.
Optional argument FORCE means to ignore a hash-hit of 'nomatch.
This depends on an up to date `ede-project-class-files' variable.
Any directory that contains the file .ede-ignore will always
-return nil."
+return nil.
+
+Consider using `ede-directory-project-cons' instead if the next
+question you want to ask is where the root of found project is."
+ ;; @TODO - We used to have a full impl here, but moved it all
+ ;; to ede-directory-project-cons, and now hash contains only
+ ;; the results of detection which includes the root dir.
+ ;; Perhaps we can eventually remove this fcn?
+ (let ((detect (ede-directory-project-cons dir force)))
+ (cdr detect)))
+
+(defun ede-directory-project-cons (dir &optional force)
+ "Return a project CONS (ROOTDIR . AUTOLOAD) for DIR.
+If there is no project in DIR, return nil.
+Optional FORCE means to ignore the hash of known directories."
(when (not (file-exists-p (expand-file-name ".ede-ignore" dir)))
(let* ((dirtest (expand-file-name dir))
- (match (ede-directory-project-from-hash dirtest)))
+ (match (ede--directory-project-from-hash dirtest)))
(cond
((and (eq match 'nomatch) (not force))
nil)
((and match (not (eq match 'nomatch)))
match)
(t
- (let ((types ede-project-class-files)
- (ret nil))
- ;; Loop over all types, loading in the first type that we find.
- (while (and types (not ret))
- (if (ede-dir-to-projectfile (car types) dirtest)
- (progn
- ;; We found one! Require it now since we will need it.
- (require (oref (car types) file))
- (setq ret (car types))))
- (setq types (cdr types)))
- (ede-directory-project-add-description-to-hash dirtest (or ret 'nomatch))
- ret))))))
+ ;; First time here? Use the detection code to identify if we have
+ ;; a project here.
+ (let* ((detect (ede-detect-directory-for-project dirtest))
+ (autoloader (cdr detect))) ;; autoloader
+ (when autoloader (require (oref autoloader file)))
+ (ede--directory-project-add-description-to-hash dirtest (or detect 'nomatch))
+ detect)
+ )))))
+
;;; TOPLEVEL
;;
;; These utilities will identify the "toplevel" of a project.
;;
-(defun ede-toplevel-project-or-nil (dir)
- "Starting with DIR, find the toplevel project directory, or return nil.
-nil is returned if the current directory is not a part of a project."
- (let* ((ans (ede-directory-get-toplevel-open-project dir)))
- (if ans
- (oref ans :directory)
- (if (ede-directory-project-p dir)
- (ede-toplevel-project dir)
- nil))))
+;; NOTE: These two -toplevel- functions return a directory even though
+;; the function name implies a project.
(defun ede-toplevel-project (dir)
- "Starting with DIR, find the toplevel project directory."
- (if (and (string= dir default-directory)
+ "Starting with DIR, find the toplevel project directory.
+If DIR is not part of a project, return nil."
+ (let ((ans nil))
+
+ (cond
+ ;; Check if it is cached in the current buffer.
+ ((and (string= dir default-directory)
ede-object-root-project)
;; Try the local buffer cache first.
- (oref ede-object-root-project :directory)
- ;; Otherwise do it the hard way.
- (let* ((thisdir (ede-directory-project-p dir))
- (ans (ede-directory-get-toplevel-open-project dir)))
- (if (and ans ;; We have an answer
- (or (not thisdir) ;; this dir isn't setup
- (and (object-of-class-p ;; Same as class for this dir?
- ans (oref thisdir :class-sym)))
- ))
- (oref ans :directory)
- (let* ((toppath (expand-file-name dir))
- (newpath toppath)
- (proj (ede-directory-project-p dir))
- (ans nil))
- (if proj
- ;; If we already have a project, ask it what the root is.
- (setq ans (ede-project-root-directory proj)))
-
- ;; If PROJ didn't know, or there is no PROJ, then
-
- ;; Loop up to the topmost project, and then load that single
- ;; project, and its sub projects. When we are done, identify the
- ;; sub-project object belonging to file.
- (while (and (not ans) newpath proj)
- (setq toppath newpath
- newpath (ede-up-directory toppath))
- (when newpath
- (setq proj (ede-directory-project-p newpath)))
-
- (when proj
- ;; We can home someone in the middle knows too.
- (setq ans (ede-project-root-directory proj)))
- )
- (or ans toppath))))))
+ (oref ede-object-root-project :directory))
+
+ ;; See if there is an existing project in DIR.
+ ((setq ans (ede-directory-get-toplevel-open-project dir))
+ (oref ans :directory))
+
+ ;; Detect using our file system detector.
+ ((setq ans (ede-detect-directory-for-project dir))
+ (car ans))
+
+ (t nil))))
+
+(defalias 'ede-toplevel-project-or-nil 'ede-toplevel-project)
;;; DIRECTORY CONVERSION STUFF
;;
@@ -509,25 +540,6 @@ Argument DIR is the directory to trim upwards."
nil
fnd)))
-(defun ede-find-project-root (prj-file-name &optional dir)
- "Tries to find directory with given project file"
- (let ((prj-dir (locate-dominating-file (or dir default-directory)
- prj-file-name)))
- (when prj-dir
- (expand-file-name prj-dir))))
-
-(defun ede-files-find-existing (dir prj-list)
- "Find a project in the list of projects stored in given variable.
-DIR is the directory to search from."
- (let ((projs prj-list)
- (ans nil))
- (while (and projs (not ans))
- (let ((root (ede-project-root-directory (car projs))))
- (when (string-match (concat "^" (regexp-quote root)) dir)
- (setq ans (car projs))))
- (setq projs (cdr projs)))
- ans))
-
(provide 'ede/files)
diff --git a/lisp/cedet/ede/generic.el b/lisp/cedet/ede/generic.el
index d6f0385cf9..f0314cb7f2 100644
--- a/lisp/cedet/ede/generic.el
+++ b/lisp/cedet/ede/generic.el
@@ -78,61 +78,18 @@
;; the above described support features.
(require 'eieio-opt)
-(require 'ede)
+(require 'ede/config)
(require 'ede/shell)
(require 'semantic/db)
;;; Code:
;;
;; Start with the configuration system
-(defclass ede-generic-config (eieio-persistent)
- ((extension :initform ".ede")
- (file-header-line :initform ";; EDE Generic Project Configuration")
- (project :initform nil
- :documentation
- "The project this config is bound to.")
- ;; Generic customizations
- (build-command :initarg :build-command
- :initform "make -k"
- :type string
- :custom string
- :group (default build)
- :documentation
- "Command used for building this project.")
- (debug-command :initarg :debug-command
- :initform "gdb "
- :type string
- :custom string
- :group (default build)
- :documentation
- "Command used for debugging this project.")
- (run-command :initarg :run-command
- :initform nil
- :type (or null string)
- :custom string
- :group (default build)
- :documentation
- "Command used to run something related to this project.")
- ;; C target customizations
- (c-include-path :initarg :c-include-path
- :initform nil
- :type list
- :custom (repeat (string :tag "Path"))
- :group c
- :documentation
- "The include path used by C/C++ projects.")
- (c-preprocessor-table :initarg :c-preprocessor-table
- :initform nil
- :type list
- :custom (repeat (cons (string :tag "Macro")
- (string :tag "Value")))
- :group c
- :documentation
- "Preprocessor Symbols for this project.")
- (c-preprocessor-files :initarg :c-preprocessor-files
- :initform nil
- :type list
- :custom (repeat (string :tag "Include File")))
+(defclass ede-generic-config (ede-extra-config
+ ede-extra-config-build
+ ede-extra-config-program
+ ede-extra-config-c)
+ ((file-header-line :initform ";; EDE Generic Project Configuration")
)
"User Configuration object for a generic project.")
@@ -142,23 +99,24 @@ Return nil if there isn't one.
Argument DIR is the directory it is created for.
ROOTPROJ is nil, since there is only one project."
;; Doesn't already exist, so let's make one.
- (let* ((alobj ede-constructing)
- (this nil))
+ (let* ((alobj ede-constructing))
(when (not alobj) (error "Cannot load generic project without the autoload instance"))
-
- (setq this
- (funcall (oref alobj class-sym)
- (symbol-name (oref alobj class-sym))
- :name (file-name-nondirectory
- (directory-file-name dir))
- :version "1.0"
- :directory (file-name-as-directory dir)
- :file (expand-file-name (oref alobj :proj-file)) ))
- (ede-add-project-to-global-list this)
+ ;;;
+ ;; TODO - find the root dir.
+ (let ((rootdir dir))
+ (funcall (oref alobj class-sym)
+ (symbol-name (oref alobj class-sym))
+ :name (file-name-nondirectory (directory-file-name dir))
+ :version "1.0"
+ :directory (file-name-as-directory rootdir)
+ :file (expand-file-name (oref alobj :proj-file)
+ rootdir)))
))
;;; Base Classes for the system
-(defclass ede-generic-target (ede-target)
+(defclass ede-generic-target (ede-target-with-config
+ ede-target-with-config-build
+ ede-target-with-config-program)
((shortname :initform ""
:type string
:allocation :class
@@ -174,16 +132,18 @@ subclasses of this base target will override the default value.")
"Baseclass for all targets belonging to the generic ede system."
:abstract t)
-(defclass ede-generic-project (ede-project)
- ((buildfile :initform ""
+(defclass ede-generic-project (ede-project-with-config
+ ede-project-with-config-build
+ ede-project-with-config-program
+ ede-project-with-config-c
+ ede-project-with-config-java)
+ ((config-class :initform ede-generic-config)
+ (config-file-basename :initform "EDEConfig.el")
+ (buildfile :initform ""
:type string
:allocation :class
:documentation "The file name that identifies a project of this type.
The class allocated value is replace by different sub classes.")
- (config :initform nil
- :type (or null ede-generic-config)
- :documentation
- "The configuration object for this project.")
)
"The baseclass for all generic EDE project types."
:abstract t)
@@ -196,37 +156,18 @@ The class allocated value is replace by different sub classes.")
(oset this :targets nil))
)
-(defmethod ede-generic-get-configuration ((proj ede-generic-project))
- "Return the configuration for the project PROJ."
- (let ((config (oref proj config)))
- (when (not config)
- (let ((fname (expand-file-name "EDEConfig.el"
- (oref proj :directory))))
- (if (file-exists-p fname)
- ;; Load in the configuration
- (setq config (eieio-persistent-read fname 'ede-generic-config))
- ;; Create a new one.
- (setq config (ede-generic-config
- "Configuration"
- :file fname))
- ;; Set initial values based on project.
- (ede-generic-setup-configuration proj config))
- ;; Link things together.
- (oset proj config config)
- (oset config project proj)))
- config))
-
-(defmethod ede-generic-setup-configuration ((proj ede-generic-project) config)
- "Default configuration setup method."
- nil)
-
-(defmethod ede-commit-project ((proj ede-generic-project))
- "Commit any change to PROJ to its file."
- (let ((config (ede-generic-get-configuration proj)))
- (ede-commit config)))
+(defmethod ede-project-root ((this ede-generic-project))
+ "Return my root."
+ this)
+
+(defmethod ede-find-subproject-for-directory ((proj ede-generic-project)
+ dir)
+ "Return PROJ, for handling all subdirs below DIR."
+ proj)
;;; A list of different targets
-(defclass ede-generic-target-c-cpp (ede-generic-target)
+(defclass ede-generic-target-c-cpp (ede-generic-target
+ ede-target-with-config-c)
((shortname :initform "C/C++")
(extension :initform "\\([ch]\\(pp\\|xx\\|\\+\\+\\)?\\|cc\\|hh\\|CC?\\)"))
"EDE Generic Project target for C and C++ code.
@@ -250,6 +191,13 @@ All directories need at least one target.")
"EDE Generic Project target for texinfo code.
All directories need at least one target.")
+(defclass ede-generic-target-java (ede-generic-target
+ ede-target-with-config-java)
+ ((shortname :initform "Java")
+ (extension :initform "java"))
+ "EDE Generic Project target for texinfo code.
+All directories need at least one target.")
+
;; MISC must always be last since it will always match the file.
(defclass ede-generic-target-misc (ede-generic-target)
((shortname :initform "Misc")
@@ -300,103 +248,6 @@ If one doesn't exist, create a new one for this directory."
)
ans))
-;;; C/C++ support
-(defmethod ede-preprocessor-map ((this ede-generic-target-c-cpp))
- "Get the pre-processor map for some generic C code."
- (let* ((proj (ede-target-parent this))
- (root (ede-project-root proj))
- (config (ede-generic-get-configuration proj))
- filemap
- )
- ;; Preprocessor files
- (dolist (G (oref config :c-preprocessor-files))
- (let ((table (semanticdb-file-table-object
- (ede-expand-filename root G))))
- (when table
- (when (semanticdb-needs-refresh-p table)
- (semanticdb-refresh-table table))
- (setq filemap (append filemap (oref table lexical-table)))
- )))
- ;; The core table
- (setq filemap (append filemap (oref config :c-preprocessor-table)))
-
- filemap
- ))
-
-(defmethod ede-system-include-path ((this ede-generic-target-c-cpp))
- "Get the system include path used by project THIS."
- (let* ((proj (ede-target-parent this))
- (config (ede-generic-get-configuration proj)))
- (oref config c-include-path)))
-
-;;; Commands
-;;
-(defmethod project-compile-project ((proj ede-generic-project) &optional command)
- "Compile the entire current project PROJ.
-Argument COMMAND is the command to use when compiling."
- (let* ((config (ede-generic-get-configuration proj))
- (comp (oref config :build-command)))
- (compile comp)))
-
-(defmethod project-compile-target ((obj ede-generic-target) &optional command)
- "Compile the current target OBJ.
-Argument COMMAND is the command to use for compiling the target."
- (project-compile-project (ede-current-project) command))
-
-(defmethod project-debug-target ((target ede-generic-target))
- "Run the current project derived from TARGET in a debugger."
- (let* ((proj (ede-target-parent target))
- (config (ede-generic-get-configuration proj))
- (debug (oref config :debug-command))
- (cmd (read-from-minibuffer
- "Debug Command: "
- debug))
- (cmdsplit (split-string cmd " " t))
- ;; @TODO - this depends on the user always typing in something good
- ;; like "gdb" or "dbx" which also exists as a useful Emacs command.
- ;; Is there a better way?
- (cmdsym (intern-soft (car cmdsplit))))
- (call-interactively cmdsym t)))
-
-(defmethod project-run-target ((target ede-generic-target))
- "Run the current project derived from TARGET."
- (let* ((proj (ede-target-parent target))
- (config (ede-generic-get-configuration proj))
- (run (concat "./" (oref config :run-command)))
- (cmd (read-from-minibuffer "Run (like this): " run)))
- (ede-shell-run-something target cmd)))
-
-;;; Customization
-;;
-(defmethod ede-customize ((proj ede-generic-project))
- "Customize the EDE project PROJ."
- (let ((config (ede-generic-get-configuration proj)))
- (eieio-customize-object config)))
-
-(defmethod ede-customize ((target ede-generic-target))
- "Customize the EDE TARGET."
- ;; Nothing unique for the targets, use the project.
- (ede-customize-project))
-
-(defmethod eieio-done-customizing ((config ede-generic-config))
- "Called when EIEIO is done customizing the configuration object.
-We need to go back through the old buffers, and update them with
-the new configuration."
- (ede-commit config)
- ;; Loop over all the open buffers, and re-apply.
- (ede-map-targets
- (oref config project)
- (lambda (target)
- (ede-map-target-buffers
- target
- (lambda (b)
- (with-current-buffer b
- (ede-apply-target-options)))))))
-
-(defmethod ede-commit ((config ede-generic-config))
- "Commit all changes to the configuration to disk."
- (eieio-persistent-save config))
-
;;; Creating Derived Projects:
;;
;; Derived projects need an autoloader so that EDE can find the
@@ -415,13 +266,16 @@ the class `ede-generic-project' project."
:name external-name
:file 'ede/generic
:proj-file projectfile
+ :root-only nil
:load-type 'ede-generic-load
:class-sym class
:new-p nil
- :safe-p nil) ; @todo - could be
- ; safe if we do something
- ; about the loading of the
- ; generic config file.
+ ;; NOTE: This project type is SAFE because it handles
+ ;; the user-query before loading its config file. These
+ ;; project types are useful without the config file so
+ ;; do the safe part until the user creates a saved config
+ ;; file for it.
+ :safe-p t)
;; Generics must go at the end, since more specific types
;; can create Makefiles also.
'generic))
@@ -436,6 +290,25 @@ the class `ede-generic-project' project."
"SConstruct" 'ede-generic-scons-project)
(ede-generic-new-autoloader "generic-cmake" "CMake"
"CMakeLists" 'ede-generic-cmake-project)
+
+ ;; Super Generic found via revision control tags.
+ (ede-generic-new-autoloader "generic-git" "Git"
+ ".git" 'ede-generic-vc-project)
+ (ede-generic-new-autoloader "generic-bzr" "Bazaar"
+ ".bzr" 'ede-generic-vc-project)
+ (ede-generic-new-autoloader "generic-hg" "Mercurial"
+ ".hg" 'ede-generic-vc-project)
+ (ede-generic-new-autoloader "generic-svn" "Subversions"
+ ".svn" 'ede-generic-vc-project)
+ (ede-generic-new-autoloader "generic-cvs" "CVS"
+ "CVS" 'ede-generic-vc-project)
+
+ ;; Take advantage of existing 'projectile' based projects.
+ ;; @TODO - if projectile supports compile commands etc, can we
+ ;; read that out? Howto if projectile is not part of core emacs.
+ (ede-generic-new-autoloader "generic-projectile" ".projectile"
+ ".projectile" 'ede-generic-vc-project)
+
)
@@ -481,6 +354,15 @@ the class `ede-generic-project' project."
(oset config debug-command "gdb ")
)
+;;; Generic Version Control System
+(defclass ede-generic-vc-project (ede-generic-project)
+ ()
+ "Generic project found via Version Control files.")
+
+(defmethod ede-generic-setup-configuration ((proj ede-generic-vc-project) config)
+ "Setup a configuration for projects identified by revision control."
+ )
+
(provide 'ede/generic)
;; Local variables:
diff --git a/lisp/cedet/ede/linux.el b/lisp/cedet/ede/linux.el
index 4e8a06ef11..b28301d777 100644
--- a/lisp/cedet/ede/linux.el
+++ b/lisp/cedet/ede/linux.el
@@ -73,37 +73,6 @@
:group 'project-linux
:type 'string)
-(defvar ede-linux-project-list nil
- "List of projects created by option `ede-linux-project'.")
-
-(defun ede-linux-file-existing (dir)
- "Find a Linux project in the list of Linux projects.
-DIR is the directory to search from."
- (let ((projs ede-linux-project-list)
- (ans nil))
- (while (and projs (not ans))
- (let ((root (ede-project-root-directory (car projs))))
- (when (string-match (concat "^" (regexp-quote root)) dir)
- (setq ans (car projs))))
- (setq projs (cdr projs)))
- ans))
-
-;;;###autoload
-(defun ede-linux-project-root (&optional dir)
- "Get the root directory for DIR."
- (when (not dir) (setq dir default-directory))
- (let ((case-fold-search t)
- (proj (ede-linux-file-existing dir)))
- (if proj
- (ede-up-directory (file-name-directory
- (oref proj :file)))
- ;; No pre-existing project. Let's take a wild-guess if we have
- ;; an Linux project here.
- (when (string-match "linux[^/]*" dir)
- (let ((base (substring dir 0 (match-end 0))))
- (when (file-exists-p (expand-file-name "scripts/ver_linux" base))
- base))))))
-
(defun ede-linux-version (dir)
"Find the Linux version for the Linux src in DIR."
(let ((buff (get-buffer-create " *linux-query*")))
@@ -124,9 +93,8 @@ DIR is the directory to search from."
(kill-buffer buff)
)))))
-(defclass ede-linux-project (ede-project eieio-instance-tracker)
- ((tracking-symbol :initform 'ede-linux-project-list)
- (build-directory :initarg :build-directory
+(defclass ede-linux-project (ede-project)
+ ((build-directory :initarg :build-directory
:type string
:documentation "Build directory.")
(architecture :initarg :architecture
@@ -226,22 +194,20 @@ until Linux is built for the first time."
Return nil if there isn't one.
Argument DIR is the directory it is created for.
ROOTPROJ is nil, since there is only one project."
- (or (ede-linux-file-existing dir)
- ;; Doesn't already exist, so let's make one.
- (let* ((bdir (ede-linux--get-build-directory dir))
- (arch (ede-linux--get-architecture dir bdir))
- (include-path (ede-linux--include-path dir bdir arch))
- (proj (ede-linux-project
- "Linux"
- :name "Linux"
- :version (ede-linux-version dir)
- :directory (file-name-as-directory dir)
- :file (expand-file-name "scripts/ver_linux"
- dir)
- :build-directory bdir
- :architecture arch
- :include-path include-path)))
- (ede-add-project-to-global-list proj))))
+ ;; Doesn't already exist, so let's make one.
+ (let* ((bdir (ede-linux--get-build-directory dir))
+ (arch (ede-linux--get-architecture dir bdir))
+ (include-path (ede-linux--include-path dir bdir arch)))
+ (ede-linux-project
+ "Linux"
+ :name "Linux"
+ :version (ede-linux-version dir)
+ :directory (file-name-as-directory dir)
+ :file (expand-file-name "scripts/ver_linux"
+ dir)
+ :build-directory bdir
+ :architecture arch
+ :include-path include-path)))
;;;###autoload
(ede-add-project-autoload
@@ -249,8 +215,6 @@ ROOTPROJ is nil, since there is only one project."
:name "LINUX ROOT"
:file 'ede/linux
:proj-file "scripts/ver_linux"
- :proj-root-dirmatch "linux[^/]*"
- :proj-root 'ede-linux-project-root
:load-type 'ede-linux-load
:class-sym 'ede-linux-project
:new-p nil
@@ -376,6 +340,8 @@ Knows about how the Linux source tree is organized."
(t nil))))
(or F (call-next-method))))
+;;; Command Support
+;;
(defmethod project-compile-project ((proj ede-linux-project)
&optional command)
"Compile the entire current project.
@@ -412,6 +378,19 @@ Argument COMMAND is the command to use for compiling the target."
(compile command)))
+(defmethod project-rescan ((this ede-linux-project))
+ "Rescan this Linux project from the sources."
+ (let* ((dir (ede-project-root-directory this))
+ (bdir (ede-linux--get-build-directory dir))
+ (arch (ede-linux--get-architecture dir bdir))
+ (inc (ede-linux--include-path dir bdir arch))
+ (ver (ede-linux-version dir)))
+ (oset this version ver)
+ (oset this :build-directory bdir)
+ (oset this :architecture arch)
+ (oset this :include-path inc)
+ ))
+
(provide 'ede/linux)
;; Local variables:
diff --git a/lisp/cedet/ede/pconf.el b/lisp/cedet/ede/pconf.el
index dca4b33131..1fa2a1c434 100644
--- a/lisp/cedet/ede/pconf.el
+++ b/lisp/cedet/ede/pconf.el
@@ -100,7 +100,7 @@ don't do it. A value of nil means to just do it.")
(ede-map-targets this 'ede-proj-tweak-autoconf)))
;; Now save
(save-buffer)
- (setq postcmd "autoreconf -i;")
+ (setq postcmd "autoreconf -f -i;")
;; Verify a bunch of files that are required by automake.
(ede-proj-configure-test-required-file this "AUTHORS")
@@ -173,11 +173,14 @@ By flushing, remove any cruft that may be in the file. Subsequent
calls to `ede-proj-tweak-autoconf' can restore items removed by flush."
nil)
+
+;; @TODO - No-one calls this ???
(defmethod ede-proj-configure-add-missing ((this ede-proj-target))
"Query if any files needed by THIS provided by automake are missing.
Results in --add-missing being passed to automake."
nil)
+;; @TODO - No-one implements this yet.
(defmethod ede-proj-configure-create-missing ((this ede-proj-target))
"Add any missing files for THIS by creating them."
nil)
diff --git a/lisp/cedet/ede/proj-elisp.el b/lisp/cedet/ede/proj-elisp.el
index f27ae8adf7..8d5a174b27 100644
--- a/lisp/cedet/ede/proj-elisp.el
+++ b/lisp/cedet/ede/proj-elisp.el
@@ -267,7 +267,8 @@ is found, such as a `-version' variable, or the standard header."
(while paths
(ede-proj-elisp-add-path (car paths))
(setq paths (cdr paths))))
- (save-buffer)) )))
+ (save-buffer)
+ (kill-buffer)))))
(defmethod ede-proj-flush-autoconf ((this ede-proj-target-elisp))
"Flush the configure file (current buffer) to accommodate THIS."
diff --git a/lisp/cedet/ede/proj.el b/lisp/cedet/ede/proj.el
index e3c2ea4b91..7f3b186f50 100644
--- a/lisp/cedet/ede/proj.el
+++ b/lisp/cedet/ede/proj.el
@@ -310,7 +310,7 @@ the PROJECT being read in is the root project."
(let ((sd (file-name-as-directory
(expand-file-name (car subdirs) project))))
(if (and (file-directory-p sd)
- (ede-directory-project-p sd))
+ (file-exists-p (expand-file-name "Project.ede" sd)))
(oset ret subproj
(cons (ede-proj-load sd (or rootproj ret))
(oref ret subproj))))
@@ -690,7 +690,10 @@ Optional argument FORCE will force items to be regenerated."
"Rescan the EDE proj project THIS."
(let ((root (or (ede-project-root this) this))
)
- (setq ede-projects (delq root ede-projects))
+ ;; @TODO - VERIFY THE BELOW WORKS
+ (ede-project-directory-remove-hash
+ (file-name-directory (ede-project-root-directory root)))
+ (ede-delete-project-from-global-list root)
;; NOTE : parent function double-checks that this dir was
;; already in memory once.
(ede-load-project-file (ede-project-root-directory root))
diff --git a/lisp/cedet/ede/project-am.el b/lisp/cedet/ede/project-am.el
index 43482ce058..3e7a97cc94 100644
--- a/lisp/cedet/ede/project-am.el
+++ b/lisp/cedet/ede/project-am.el
@@ -409,7 +409,7 @@ Argument COMMAND is the command to use for compiling the target."
(setq default-directory dd)
(setq cmd (read-from-minibuffer
"Run (like this): "
- (concat (ede-target-name obj))))
+ (concat "./" (ede-target-name obj))))
(ede-shell-run-something obj cmd))
(kill-buffer tb))))
@@ -428,12 +428,8 @@ Argument COMMAND is the command to use for compiling the target."
If a given set of projects has already been loaded, then do nothing
but return the project for the directory given.
Optional ROOTPROJ is the root EDE project."
- (let* ((ede-constructing t)
- (amo (object-assoc (expand-file-name "Makefile.am" directory)
- 'file ede-projects)))
- (when (not amo)
- (setq amo (project-am-load-makefile directory)))
- amo))
+ ;; Just jump into creating the project from the Makefiles.
+ (project-am-load-makefile directory))
(defun project-am-find-topmost-level (dir)
"Find the topmost automakefile starting with DIR."
diff --git a/lisp/cedet/ede/shell.el b/lisp/cedet/ede/shell.el
index 3d6eb194e4..d28977bd14 100644
--- a/lisp/cedet/ede/shell.el
+++ b/lisp/cedet/ede/shell.el
@@ -42,10 +42,15 @@ COMMAND is a text string representing the thing to be run."
;; Show the new buffer.
(when (not (get-buffer-window buff))
(switch-to-buffer-other-window buff t))
- ;; Force a shell into the buffer.
- (shell buff)
- (while (eq (point-min) (point))
- (accept-process-output))
+ ;; Force a shell into the buffer, but only if the buffer
+ ;; doesn't already have a shell in it.
+ ;; Newer versions of `shell' pop the window forward.
+ (set-buffer buff)
+ (when (not (eq major-mode 'shell-mode))
+ (shell buff)
+ ;; Make sure the shell has started.
+ (while (eq (point-min) (point))
+ (accept-process-output)))
;; Change the default directory
(if (not (string= (file-name-as-directory (expand-file-name default-directory))
(file-name-as-directory (expand-file-name dd))))
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index 5fc51e02a0..7eddf827e4 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -382,7 +382,7 @@ Arguments START and END bound the time being calculated."
(defun bovinate (&optional clear)
"Parse the current buffer. Show output in a temp buffer.
Optional argument CLEAR will clear the cache before parsing.
-If CLEAR is negative, it will do a full reparse, and also not display
+If CLEAR is negative, it will do a full reparse, and also display
the output buffer."
(interactive "P")
(if clear (semantic-clear-toplevel-cache))
@@ -392,7 +392,8 @@ the output buffer."
(end (current-time)))
(message "Retrieving tags took %.2f seconds."
(semantic-elapsed-time start end))
- (when (or (null clear) (not (listp clear)))
+ (when (or (null clear) (not (listp clear))
+ (and (numberp clear) (< 0 clear)))
(pop-to-buffer "*Parser Output*")
(require 'pp)
(erase-buffer)
@@ -1126,8 +1127,16 @@ Semantic mode.
;; Add semantic-ia-complete-symbol to
;; completion-at-point-functions, so that it is run from
;; M-TAB.
+ ;;
+ ;; Note: The first entry added is the last entry run, so the
+ ;; most specific entry should be last.
(add-hook 'completion-at-point-functions
- 'semantic-completion-at-point-function)
+ 'semantic-analyze-nolongprefix-completion-at-point-function)
+ (add-hook 'completion-at-point-functions
+ 'semantic-analyze-notc-completion-at-point-function)
+ (add-hook 'completion-at-point-functions
+ 'semantic-analyze-completion-at-point-function)
+
(if global-ede-mode
(define-key cedet-menu-map [cedet-menu-separator] '("--")))
(dolist (b (buffer-list))
@@ -1139,7 +1148,12 @@ Semantic mode.
;; Semantic can be re-activated cleanly.
(remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn)
(remove-hook 'completion-at-point-functions
- 'semantic-completion-at-point-function)
+ 'semantic-analyze-completion-at-point-function)
+ (remove-hook 'completion-at-point-functions
+ 'semantic-analyze-notc-completion-at-point-function)
+ (remove-hook 'completion-at-point-functions
+ 'semantic-analyze-nolongprefix-completion-at-point-function)
+
(remove-hook 'after-change-functions
'semantic-change-function)
(define-key cedet-menu-map [cedet-menu-separator] nil)
@@ -1155,8 +1169,53 @@ Semantic mode.
;; re-activated.
(setq semantic-new-buffer-fcn-was-run nil)))
-(defun semantic-completion-at-point-function ()
- 'semantic-ia-complete-symbol)
+;;; Completion At Point functions
+(defun semantic-analyze-completion-at-point-function ()
+ "Return possible analasis completions at point.
+The completions provided are via `semantic-analyze-possible-completions'.
+This function can be used by `completion-at-point-functions'."
+ (let* ((ctxt (semantic-analyze-current-context))
+ (possible (semantic-analyze-possible-completions ctxt)))
+
+ ;; The return from this is either:
+ ;; nil - not applicable here.
+ ;; A list: (START END COLLECTION . PROPS)
+ (when possible
+ (list (car (oref ctxt bounds))
+ (cdr (oref ctxt bounds))
+ possible))
+ ))
+
+(defun semantic-analyze-notc-completion-at-point-function ()
+ "Return possible analasis completions at point.
+The completions provided are via `semantic-analyze-possible-completions',
+but with the 'no-tc option passed in, which means constraints based
+on what is being assigned to are ignored.
+This function can be used by `completion-at-point-functions'."
+ (let* ((ctxt (semantic-analyze-current-context))
+ (possible (semantic-analyze-possible-completions ctxt 'no-tc)))
+
+ (when possible
+ (list (car (oref ctxt bounds))
+ (cdr (oref ctxt bounds))
+ possible))
+ ))
+
+(defun semantic-analyze-nolongprefix-completion-at-point-function ()
+ "Return possible analasis completions at point.
+The completions provided are via `semantic-analyze-possible-completions',
+but with the 'no-tc and 'no-longprefix option passed in, which means
+constraints resulting in a long multi-symbol dereference are ignored.
+This function can be used by `completion-at-point-functions'."
+ (let* ((ctxt (semantic-analyze-current-context))
+ (possible (semantic-analyze-possible-completions
+ ctxt 'no-tc 'no-longprefix)))
+
+ (when possible
+ (list (car (oref ctxt bounds))
+ (cdr (oref ctxt bounds))
+ possible))
+ ))
;;; Autoload some functions that are not in semantic/loaddefs
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el
index ffc2c327c5..77e091721c 100644
--- a/lisp/cedet/semantic/analyze.el
+++ b/lisp/cedet/semantic/analyze.el
@@ -226,8 +226,8 @@ Optional argument DESIRED-TYPE may be a non-type tag to analyze."
;; by an application that doesn't need to calculate the full
;; context.
-(define-overloadable-function semantic-analyze-find-tag-sequence (sequence &optional
- scope typereturn throwsym)
+(define-overloadable-function semantic-analyze-find-tag-sequence
+ (sequence &optional scope typereturn throwsym &rest flags)
"Attempt to find all tags in SEQUENCE.
Optional argument LOCALVAR is the list of local variables to use when
finding the details on the first element of SEQUENCE in case
@@ -237,53 +237,67 @@ scoped. These are not local variables, but symbols available in a structure
which doesn't need to be dereferenced.
Optional argument TYPERETURN is a symbol in which the types of all found
will be stored. If nil, that data is thrown away.
-Optional argument THROWSYM specifies a symbol the throw on non-recoverable error.")
+Optional argument THROWSYM specifies a symbol the throw on non-recoverable error.
+Remaining arguments FLAGS are additional flags to apply when searching.")
-(defun semantic-analyze-find-tag-sequence-default (sequence &optional
- scope typereturn
- throwsym)
+(defun semantic-analyze-find-tag-sequence-default
+ ;; Note: overloadable fcn uses &rest, but it is a list already, so we don't need
+ ;; to do that in the -default.
+ (sequence &optional scope typereturn throwsym flags)
"Attempt to find all tags in SEQUENCE.
SCOPE are extra tags which are in scope.
TYPERETURN is a symbol in which to place a list of tag classes that
are found in SEQUENCE.
-Optional argument THROWSYM specifies a symbol the throw on non-recoverable error."
+Optional argument THROWSYM specifies a symbol the throw on non-recoverable error.
+Remaining arguments FLAGS are additional flags to apply when searching.
+This function knows of flags:
+ 'mustbeclassvariable"
(let ((s sequence) ; copy of the sequence
(tmp nil) ; tmp find variable
(tag nil) ; tag return list
(tagtype nil) ; tag types return list
(fname nil)
(miniscope (when scope (clone scope)))
+ (tagclass (if (memq 'mustbeclassvariable flags)
+ 'variable nil))
)
;; First order check. Is this wholly contained in the typecache?
(setq tmp (semanticdb-typecache-find sequence))
-
- (if tmp
- (progn
+
+ (when tmp
+ (if (or (not tagclass) (semantic-tag-of-class-p tmp tagclass))
;; We are effectively done...
- (setq s nil)
- (setq tag (list tmp)))
-
- ;; For the first entry, it better be a variable, but it might
- ;; be in the local context too.
- ;; NOTE: Don't forget c++ namespace foo::bar.
- (setq tmp (or
- ;; Is this tag within our scope. Scopes can sometimes
- ;; shadow other things, so it goes first.
- (and scope (semantic-scope-find (car s) nil scope))
- ;; Find the tag out there... somewhere, but not in scope
- (semantic-analyze-find-tag (car s))
- ))
-
- (if (and (listp tmp) (semantic-tag-p (car tmp)))
- (setq tmp (semantic-analyze-select-best-tag tmp)))
- (if (not (semantic-tag-p tmp))
- (if throwsym
- (throw throwsym "Cannot find definition")
- (error "Cannot find definition for \"%s\"" (car s))))
- (setq s (cdr s))
- (setq tag (cons tmp tag)) ; tag is nil here...
- (setq fname (semantic-tag-file-name tmp))
- )
+ (setq s nil
+ tag (list tmp))
+ ;; tagclass doesn't match, so fail this.
+ (setq tmp nil)))
+
+ (unless tmp
+ ;; For tag class filtering, only apply the filter if the first entry
+ ;; is also the only entry.
+ (let ((lftagclass (if (= (length s) 1) tagclass)))
+
+ ;; For the first entry, it better be a variable, but it might
+ ;; be in the local context too.
+ ;; NOTE: Don't forget c++ namespace foo::bar.
+ (setq tmp (or
+ ;; Is this tag within our scope. Scopes can sometimes
+ ;; shadow other things, so it goes first.
+ (and scope (semantic-scope-find (car s) lftagclass scope))
+ ;; Find the tag out there... somewhere, but not in scope
+ (semantic-analyze-find-tag (car s) lftagclass)
+ ))
+
+ (if (and (listp tmp) (semantic-tag-p (car tmp)))
+ (setq tmp (semantic-analyze-select-best-tag tmp lftagclass)))
+ (if (not (semantic-tag-p tmp))
+ (if throwsym
+ (throw throwsym "Cannot find definition")
+ (error "Cannot find definition for \"%s\"" (car s))))
+ (setq s (cdr s))
+ (setq tag (cons tmp tag)) ; tag is nil here...
+ (setq fname (semantic-tag-file-name tmp))
+ ))
;; For the middle entries
(while s
@@ -382,7 +396,8 @@ searches use the same arguments."
;; Search in the typecache. First entries in a sequence are
;; often there.
(setq retlist (semanticdb-typecache-find name))
- (if retlist
+ (if (and retlist (or (not tagclass)
+ (semantic-tag-of-class-p retlist 'tagclass)))
retlist
(semantic-analyze-select-best-tag
(semanticdb-strip-find-results
@@ -647,7 +662,7 @@ Returns an object based on symbol `semantic-analyze-context'."
;; We have some sort of an assignment
(condition-case err
(setq asstag (semantic-analyze-find-tag-sequence
- assign scope))
+ assign scope nil nil 'mustbeclassvariable))
(error (semantic-analyze-push-error err)
nil)))
@@ -746,22 +761,26 @@ Some useful functions are found in `semantic-format-tag-functions'."
"Send the tag SEQUENCE to standard out.
Use PREFIX as a label.
Use BUFF as a source of override methods."
+ ;; If there is no sequence, at least show the field as being empty.
+ (unless sequence (princ prefix) (princ "<none>\n"))
+
+ ;; Display the sequence column aligned.
(while sequence
- (princ prefix)
- (cond
- ((semantic-tag-p (car sequence))
- (princ (funcall semantic-analyze-summary-function
- (car sequence))))
- ((stringp (car sequence))
- (princ "\"")
- (princ (semantic--format-colorize-text (car sequence) 'variable))
- (princ "\""))
- (t
- (princ (format "'%S" (car sequence)))))
- (princ "\n")
- (setq sequence (cdr sequence))
- (setq prefix (make-string (length prefix) ? ))
- ))
+ (princ prefix)
+ (cond
+ ((semantic-tag-p (car sequence))
+ (princ (funcall semantic-analyze-summary-function
+ (car sequence))))
+ ((stringp (car sequence))
+ (princ "\"")
+ (princ (semantic--format-colorize-text (car sequence) 'variable))
+ (princ "\""))
+ (t
+ (princ (format "'%S" (car sequence)))))
+ (princ "\n")
+ (setq sequence (cdr sequence))
+ (setq prefix (make-string (length prefix) ? ))
+ ))
(defmethod semantic-analyze-show ((context semantic-analyze-context))
"Insert CONTEXT into the current buffer in a nice way."
diff --git a/lisp/cedet/semantic/analyze/complete.el b/lisp/cedet/semantic/analyze/complete.el
index 0d2d5f998b..9fa400122f 100644
--- a/lisp/cedet/semantic/analyze/complete.el
+++ b/lisp/cedet/semantic/analyze/complete.el
@@ -112,8 +112,9 @@ in a buffer."
Argument CONTEXT is an object specifying the locally derived context.
The optional argument FLAGS changes which return options are returned.
FLAGS can be any number of:
- 'no-tc - do not apply data-type constraint.
- 'no-unique - do not apply unique by name filtering."
+ 'no-tc - do not apply data-type constraint.
+ 'no-longprefix - ignore long multi-symbol prefixes.
+ 'no-unique - do not apply unique by name filtering."
(let* ((a context)
(desired-type (semantic-analyze-type-constraint a))
(desired-class (oref a prefixclass))
@@ -127,9 +128,16 @@ FLAGS can be any number of:
(c nil)
(any nil)
(do-typeconstraint (not (memq 'no-tc flags)))
+ (do-longprefix (not (memq 'no-longprefix flags)))
(do-unique (not (memq 'no-unique flags)))
)
+ (when (not do-longprefix)
+ ;; If we are not doing the long prefix, shorten all the key
+ ;; elements.
+ (setq prefix (list (car (reverse prefix)))
+ prefixtypes nil))
+
;; Calculate what our prefix string is so that we can
;; find all our matching text.
(setq completetext (car (reverse prefix)))
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index e9715cc1bb..9aceca8af1 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -270,7 +270,7 @@ Return the defined symbol as a special spp lex token."
(if (looking-back "/\\*.*" beginning-of-define)
(progn
(goto-char (match-beginning 0))
- (1- (point)))
+ (point))
(point)))))
)
@@ -501,7 +501,13 @@ code to parse."
(hif-canonicalize)
(error nil))))
- (let ((eval-form (eval parsedtokelist)))
+ (let ((eval-form (condition-case err
+ (eval parsedtokelist)
+ (error
+ (semantic-push-parser-warning
+ (format "Hideif forms produced an error. Assuming false.\n%S" err)
+ (point) (1+ (point)))
+ nil))))
(if (or (not eval-form)
(and (numberp eval-form)
(equal eval-form 0)));; ifdef line resulted in false
diff --git a/lisp/cedet/semantic/bovine/grammar.el b/lisp/cedet/semantic/bovine/grammar.el
index 4676578935..55df00245f 100644
--- a/lisp/cedet/semantic/bovine/grammar.el
+++ b/lisp/cedet/semantic/bovine/grammar.el
@@ -395,16 +395,33 @@ manual."
(insert ")\n")
(buffer-string))))
+(defun bovine-grammar-calculate-source-on-path ()
+ "Calculate the location of the source for current buffer.
+The source directory is relative to some root in the load path."
+ (condition-case nil
+ (let* ((dir (nreverse (split-string (buffer-file-name) "/")))
+ (newdir (car dir)))
+ (setq dir (cdr dir))
+ ;; Keep trying the file name until it is on the path.
+ (while (and (not (locate-library newdir)) dir)
+ (setq newdir (concat (car dir) "/" newdir)
+ dir (cdr dir)))
+ (if (not dir)
+ (buffer-name)
+ newdir))
+ (error (buffer-name))))
+
(defun bovine-grammar-setupcode-builder ()
"Return the text of the setup code."
(format
"(setq semantic--parse-table %s\n\
semantic-debug-parser-source %S\n\
semantic-debug-parser-class 'semantic-bovine-debug-parser
+ semantic-debug-parser-debugger-source 'semantic/bovine/debug
semantic-flex-keywords-obarray %s\n\
%s)"
(semantic-grammar-parsetable)
- (buffer-name)
+ (bovine-grammar-calculate-source-on-path)
(semantic-grammar-keywordtable)
(let ((mode (semantic-grammar-languagemode)))
;; Is there more than one major mode?
diff --git a/lisp/cedet/semantic/bovine/scm.el b/lisp/cedet/semantic/bovine/scm.el
index 4fa34dfcc3..4e01c33cf6 100644
--- a/lisp/cedet/semantic/bovine/scm.el
+++ b/lisp/cedet/semantic/bovine/scm.el
@@ -69,7 +69,7 @@ Attempts a simple prototype for calling or using TAG."
;; Note: Analyzer from Henry S. Thompson
(define-lex-regex-analyzer semantic-lex-scheme-symbol
"Detect and create symbol and keyword tokens."
- "\\(\\sw\\([:]\\|\\sw\\|\\s_\\)+\\)"
+ "\\(\\sw\\([:]\\|\\sw\\|\\s_\\)*\\)"
;; (message (format "symbol: %s" (match-string 0)))
(semantic-lex-push-token
(semantic-lex-token
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index 76a49ddc54..12be66225a 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -124,6 +124,18 @@ for a new table not associated with a buffer."
If the buffer is not in memory, load it with `find-file-noselect'."
nil)
+;; This generic method allows for sloppier coding. Many
+;; functions treat "table" as something that could be a buffer,
+;; file name, or other. This makes use of table more robust.
+(defmethod semanticdb-full-filename (buffer-or-string)
+ "Fetch the full filename that BUFFER-OR-STRING referrs to.
+This uses semanticdb to get a better file name."
+ (cond ((bufferp buffer-or-string)
+ (with-current-buffer buffer-or-string
+ (semanticdb-full-filename semanticdb-current-table)))
+ ((and (stringp buffer-or-string) (file-exists-p buffer-or-string))
+ (expand-file-name buffer-or-string))))
+
(defmethod semanticdb-full-filename ((obj semanticdb-abstract-table))
"Fetch the full filename that OBJ refers to.
Abstract tables do not have file names associated with them."
diff --git a/lisp/cedet/semantic/debug.el b/lisp/cedet/semantic/debug.el
index 80081efd23..91819b89bd 100644
--- a/lisp/cedet/semantic/debug.el
+++ b/lisp/cedet/semantic/debug.el
@@ -57,6 +57,12 @@ to one of the parser generators.")
;;;###autoload
(make-variable-buffer-local 'semantic-debug-parser-class)
+;;;###autoload
+(defvar semantic-debug-parser-debugger-source nil
+ "Location of the debug parser class.")
+;;;###autoload
+(make-variable-buffer-local 'semantic-debug-parser-source)
+
(defvar semantic-debug-enabled nil
"Non-nil when debugging a parser.")
@@ -104,6 +110,7 @@ These buffers are brought into view when layout occurs.")
"The currently displayed frame.")
(overlays :type list
:initarg nil
+ :initform nil
:documentation
"Any active overlays being used to show the debug position.")
)
@@ -323,15 +330,18 @@ Argument ONOFF is non-nil when we are entering debug mode.
(oref semantic-debug-current-interface parser-buffer)
(use-local-map
(oref semantic-debug-current-interface parser-local-map))
+ (setq buffer-read-only nil)
)
(with-current-buffer
(oref semantic-debug-current-interface source-buffer)
(use-local-map
(oref semantic-debug-current-interface source-local-map))
+ (setq buffer-read-only nil)
)
(run-hooks 'semantic-debug-exit-hook)
)))
+;;;###autoload
(defun semantic-debug ()
"Parse the current buffer and run in debug mode."
(interactive)
@@ -341,6 +351,9 @@ Argument ONOFF is non-nil when we are entering debug mode.
(error "This major mode does not support parser debugging"))
;; Clear the cache to force a full reparse.
(semantic-clear-toplevel-cache)
+ ;; Load in the debugger for this file.
+ (when semantic-debug-parser-debugger-source
+ (require semantic-debug-parser-debugger-source))
;; Do the parse
(let ((semantic-debug-enabled t)
;; Create an interface
diff --git a/lisp/cedet/semantic/doc.el b/lisp/cedet/semantic/doc.el
index 2f9a570eb3..fdaeb95d00 100644
--- a/lisp/cedet/semantic/doc.el
+++ b/lisp/cedet/semantic/doc.el
@@ -118,7 +118,8 @@ If NOSNARF is 'lex, then return the lex token."
(setq ct (concat (substring ct 0 (match-beginning 0))
(substring ct (match-end 0)))))
;; Remove comment delimiter at the end of the string.
- (when (string-match (concat (regexp-quote comment-end) "$") ct)
+ (when (and comment-end (not (string= comment-end ""))
+ (string-match (concat (regexp-quote comment-end) "$") ct))
(setq ct (substring ct 0 (match-beginning 0)))))
;; Now return the text.
ct))))
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index 994d85c7b2..d9513981bc 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -333,6 +333,25 @@ Use the `semantic-symref-hit-tags' method to get this list.")
)
))
+(defvar semantic-symref-recently-opened-buffers nil
+ "List of buffers opened by `semantic-symref-result-get-tags'.")
+
+(defun semantic-symref-cleanup-recent-buffers-fcn ()
+ "Hook function to be used in 'post-command-hook' to cleanup buffers.
+Buffers collected during symref can result in some files being
+opened multiple times for one operation. This will keep buffers open
+until the next command is executed."
+ ;;(message "To Clean Up: %S" semantic-symref-recently-opened-buffers)
+ (mapc (lambda (buff)
+ ;; Don't delete any buffers which are being used
+ ;; upon completion of some command.
+ (when (not (get-buffer-window buff))
+ (kill-buffer buff)))
+ semantic-symref-recently-opened-buffers)
+ (setq semantic-symref-recently-opened-buffers nil)
+ (remove-hook 'post-command-hook 'semantic-symref-cleanup-recent-buffers-fcn)
+ )
+
(defmethod semantic-symref-result-get-tags ((result semantic-symref-result)
&optional open-buffers)
"Get the list of tags from the symref result RESULT.
@@ -347,75 +366,19 @@ already."
(txt (oref (oref result :created-by) :searchfor))
(searchtype (oref (oref result :created-by) :searchtype))
(ans nil)
- (out nil)
- (buffs-to-kill nil))
+ (out nil))
(save-excursion
- (setq
- ans
- (mapcar
- (lambda (hit)
- (let* ((line (car hit))
- (file (cdr hit))
- (buff (find-buffer-visiting file))
- (tag nil)
- )
- (cond
- ;; We have a buffer already. Check it out.
- (buff
- (set-buffer buff))
-
- ;; We have a table, but it needs a refresh.
- ;; This means we should load in that buffer.
- (t
- (let ((kbuff
- (if open-buffers
- ;; Even if we keep the buffers open, don't
- ;; let EDE ask lots of questions.
- (let ((ede-auto-add-method 'never))
- (find-file-noselect file t))
- ;; When not keeping the buffers open, then
- ;; don't setup all the fancy froo-froo features
- ;; either.
- (semantic-find-file-noselect file t))))
- (set-buffer kbuff)
- (setq buffs-to-kill (cons kbuff buffs-to-kill))
- (semantic-fetch-tags)
- ))
- )
-
- ;; Too much baggage in goto-line
- ;; (goto-line line)
- (goto-char (point-min))
- (forward-line (1- line))
-
- ;; Search forward for the matching text
- (when (re-search-forward (regexp-quote txt)
- (point-at-eol)
- t)
- (goto-char (match-beginning 0))
- )
-
- (setq tag (semantic-current-tag))
-
- ;; If we are searching for a tag, but bound the tag we are looking
- ;; for, see if it resides in some other parent tag.
- ;;
- ;; If there is no parent tag, then we still need to hang the originator
- ;; in our list.
- (when (and (eq searchtype 'symbol)
- (string= (semantic-tag-name tag) txt))
- (setq tag (or (semantic-current-tag-parent) tag)))
-
- ;; Copy the tag, which adds a :filename property.
- (when tag
- (setq tag (semantic-tag-copy tag nil t))
- ;; Ad this hit to the tag.
- (semantic--tag-put-property tag :hit (list line)))
- tag))
- lines)))
+ (setq ans (mapcar
+ (lambda (hit)
+ (semantic-symref-hit-to-tag-via-buffer
+ hit txt searchtype open-buffers))
+ lines)))
;; Kill off dead buffers, unless we were requested to leave them open.
- (when (not open-buffers)
- (mapc 'kill-buffer buffs-to-kill))
+ (if (not open-buffers)
+ (add-hook 'post-command-hook 'semantic-symref-cleanup-recent-buffers-fcn)
+ ;; Else, just clear the saved buffers so they aren't deleted later.
+ (setq semantic-symref-recently-opened-buffers nil)
+ )
;; Strip out duplicates.
(dolist (T ans)
(if (and T (not (semantic-equivalent-tag-p (car out) T)))
@@ -429,6 +392,111 @@ already."
;; Out is reversed... twice
(oset result :hit-tags (nreverse out)))))
+(defun semantic-symref-hit-to-tag-via-db (hit searchtxt searchtype)
+ "Convert the symref HIT into a TAG by looking up the tag via a database.
+Return the Semantic tag associated with HIT.
+SEARCHTXT is the text that is being searched for.
+Used to narrow the in-buffer search.
+SEARCHTYPE is the type of search (such as 'symbol or 'tagname).
+If there is no database, of if the searchtype is wrong, return nil."
+ ;; Allowed search types for this mechanism:
+ ;; tagname, tagregexp, tagcompletions
+ (if (not (memq searchtype '(tagname tagregexp tagcompletions)))
+ nil
+ (let* ((line (car hit))
+ (file (cdr hit))
+ ;; FAIL here vv - don't load is not obeyed if no table found.
+ (db (semanticdb-file-table-object file t))
+ (found nil)
+ (hit nil)
+ )
+ (cond ((eq searchtype 'tagname)
+ (setq found (semantic-find-tags-by-name searchtxt db)))
+ ((eq searchtype 'tagregexp)
+ (setq found (semantic-find-tags-by-name-regexp searchtxt db)))
+ ((eq searchtype 'tagcompletions)
+ (setq found (semantic-find-tags-for-completion searchtxt db)))
+ )
+ ;; Loop over FOUND to see if we can line up a match with a line number.
+ (when (= (length found) 1)
+ (setq hit (car found)))
+
+ ;; FAIL here ^^ - symref finds line numbers, but our DB uses character locations.
+ ;; as such, this is a cheat and we will need to give up.
+ hit)))
+
+(defun semantic-symref-hit-to-tag-via-buffer (hit searchtxt searchtype &optional open-buffers)
+ "Convert the symref HIT into a TAG by looking up the tag via a buffer.
+Return the Semantic tag associated with HIT.
+SEARCHTXT is the text that is being searched for.
+Used to narrow the in-buffer search.
+SEARCHTYPE is the type of search (such as 'symbol or 'tagname).
+Optional OPEN-BUFFERS, when nil will use a faster version of
+`find-file' when a file needs to be opened. If non-nil, then
+normal buffer initialization will be used.
+This function will leave buffers loaded from a file open, but
+will add buffers that must be opened to `semantic-symref-recently-opened-buffers'.
+Any caller MUST deal with that variable, either clearing it, or deleting the
+buffers that were opened."
+ (let* ((line (car hit))
+ (file (cdr hit))
+ (buff (find-buffer-visiting file))
+ (tag nil)
+ )
+ (cond
+ ;; We have a buffer already. Check it out.
+ (buff
+ (set-buffer buff))
+
+ ;; We have a table, but it needs a refresh.
+ ;; This means we should load in that buffer.
+ (t
+ (let ((kbuff
+ (if open-buffers
+ ;; Even if we keep the buffers open, don't
+ ;; let EDE ask lots of questions.
+ (let ((ede-auto-add-method 'never))
+ (find-file-noselect file t))
+ ;; When not keeping the buffers open, then
+ ;; don't setup all the fancy froo-froo features
+ ;; either.
+ (semantic-find-file-noselect file t))))
+ (set-buffer kbuff)
+ (push kbuff semantic-symref-recently-opened-buffers)
+ (semantic-fetch-tags)
+ ))
+ )
+
+ ;; Too much baggage in goto-line
+ ;; (goto-line line)
+ (goto-char (point-min))
+ (forward-line (1- line))
+
+ ;; Search forward for the matching text
+ (when (re-search-forward (regexp-quote searchtxt)
+ (point-at-eol)
+ t)
+ (goto-char (match-beginning 0))
+ )
+
+ (setq tag (semantic-current-tag))
+
+ ;; If we are searching for a tag, but bound the tag we are looking
+ ;; for, see if it resides in some other parent tag.
+ ;;
+ ;; If there is no parent tag, then we still need to hang the originator
+ ;; in our list.
+ (when (and (eq searchtype 'symbol)
+ (string= (semantic-tag-name tag) searchtxt))
+ (setq tag (or (semantic-current-tag-parent) tag)))
+
+ ;; Copy the tag, which adds a :filename property.
+ (when tag
+ (setq tag (semantic-tag-copy tag nil t))
+ ;; Ad this hit to the tag.
+ (semantic--tag-put-property tag :hit (list line)))
+ tag))
+
;;; SYMREF TOOLS
;;
;; The base symref tool provides something to hang new tools off of
diff --git a/lisp/cedet/srecode/java.el b/lisp/cedet/srecode/java.el
index f6cd3f893d..1b1c184fe8 100644
--- a/lisp/cedet/srecode/java.el
+++ b/lisp/cedet/srecode/java.el
@@ -40,16 +40,15 @@ FILENAME_AS_CLASS - file converted to a Java class name."
(fnox (file-name-sans-extension fsym))
(dir (file-name-directory (buffer-file-name)))
(fpak fsym)
+ (proj (ede-current-project))
+ (pths (ede-source-paths proj 'java-mode))
)
(while (string-match "\\.\\| " fpak)
(setq fpak (replace-match "_" t t fpak)))
;; We can extract package from:
;; 1) a java EDE project source paths,
- (cond ((ede-current-project)
- (let* ((proj (ede-current-project))
- (pths (ede-source-paths proj 'java-mode))
- (pth)
- (res))
+ (cond ((and proj pths)
+ (let* ((pth) (res))
(while (and (not res)
(setq pth (expand-file-name (car pths))))
(when (string-match pth dir)
diff --git a/lisp/emacs-lisp/eieio-custom.el b/lisp/emacs-lisp/eieio-custom.el
index cbb35fee3f..df153eefd0 100644
--- a/lisp/emacs-lisp/eieio-custom.el
+++ b/lisp/emacs-lisp/eieio-custom.el
@@ -383,7 +383,7 @@ These groups are specified with the `:group' slot flag."
(make-local-variable 'eieio-co)
(setq eieio-co obj)
(make-local-variable 'eieio-cog)
- (setq eieio-cog group)))
+ (setq eieio-cog g)))
(defmethod eieio-custom-object-apply-reset ((obj eieio-default-superclass))
"Insert an Apply and Reset button into the object editor.
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index df2ce0f984..c8330d5b69 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -895,7 +895,7 @@ variable PRINT-FUNCTION. Optional argument NOESCAPE is passed to
;;; Start of automatically extracted autoloads.
-;;;### (autoloads nil "eieio-custom" "eieio-custom.el" "5b0e7b1beea11f9e9de6887279f75d61")
+;;;### (autoloads nil "eieio-custom" "eieio-custom.el" "ab711689b2bae8a7d8c4b1e99c892306")
;;; Generated autoloads from eieio-custom.el
(autoload 'customize-object "eieio-custom" "\