summaryrefslogtreecommitdiff
path: root/lisp/cedet/srecode
diff options
context:
space:
mode:
authorDavid Engster <dengste@eml.cc>2013-03-21 23:11:03 +0100
committerDavid Engster <dengste@eml.cc>2013-03-21 23:11:03 +0100
commite8cc7880c3eead07c1d4fd93c0396edc3861b080 (patch)
tree8cae5f08a001885128786a3925dc49e156bd60aa /lisp/cedet/srecode
parent3fc5e44aaaac666b7f6a77b2e2fcc0c6646659d5 (diff)
downloademacs-e8cc7880c3eead07c1d4fd93c0396edc3861b080.tar.gz
Merge with CEDET upstream (rev. 8499).
lisp/ * eieio/eieio-datadebug.el (data-debug/eieio-insert-slots): Inhibit read only while inserting objects. lisp/cedet/ * semantic.el (navigate-menu): Yank Tag :enable. Make sure `senator-tag-ring' is bound. (semantic-parse-region-default): Stop reversing the output of parse-whole-stream. (semantic-repeat-parse-whole-stream): Append returned tags differently, so they come out in the right order. * semantic/sb.el (semantic-sb-filter-tags-of-class): New option. (semantic-sb-fetch-tag-table): Filter tags being bucketed to exclude tags belonging to above filtered classes. * semantic/find.el (semantic-filter-tags-by-class): New function. * semantic/tag-ls.el (semantic-tag-similar-p-default): Add short-circuit in case tag1 and 2 are identical. * semantic/analyze/fcn.el (semantic-analyze-dereference-metatype-stack): Use `semantic-tag-similar-p' instead of 'eq' when comparing two tags during metatype evaluation in case they are the same, but not the same node. (Tweaked patch from Tomasz Gajewski) (Tiny change) * semantic/db-find.el (semanticdb-partial-synchronize): Fix require to semantic/db-typecache to be correct. (semanticdb-find-tags-external-children-of-type): Make this a brutish search by default. * semantic/sort.el (semantic-tag-external-member-children-default): When calling `semanticdb-find-tags-external-children-of-type', pass in the input tag as the place to start searching for externally defined methods. * semantic/db-file.el (semanticdb-default-save-directory): Doc fix: Add ref to default value. * semantic/complete.el (semantic-complete-post-command-hook): When detecting if cursor is outside completion area, do so if cursor moves before start of overlay, or the original starting location of the overlay (i.e., if user deletes past beginning of the overlay region). (semantic-complete-inline-tag-engine): Initialize original start of `semantic-complete-inline-overlay'. * semantic/bovine/c.el (semantic-c-describe-environment): Update some section titles. Test semanticdb table before printing it. (semantic-c-reset-preprocessor-symbol-map): Update `semantic-lex-spp-macro-symbol-obarray' outside the loop over all the files contributing to its value. (semantic-c-describe-environment): If there is an EDE project but no spp symbols from it, say so. * srecode/args.el (srecode-semantic-handle-:project): New argument handler. Provide variable values if not in an EDE project. * srecode/srt-mode.el (srecode-template-mode): Fix typo on srecode name. * srecode/cpp.el (srecode-semantic-handle-:c): Replace all characters in FILENAME_SYMBOL that aren't valid CPP symbol chars. * srecode/map.el (srecode-map-validate-file-for-mode): Force semantic to load if it is not active in the template being added to the map. * srecode/srt.el: Add local variables for setting the autoload file name. (srecode-semantic-handle-:srt): New autoload cookie * ede.el (ede-apply-preprocessor-map): Apply map to `semantic-lex-spp-project-macro-symbol-obarray' instead of the system one. Add require for semantic. * ede/proj-elisp.el (ede-update-version-in-source): In case a file has both a version variable and a Version: comment, always use `call-next-method'. * ede/cpp-root.el (ede-set-project-variables): Deleted. `ede-preprocessor-map' does the job this function was attempting to do with :spp-table. (ede-preprocessor-map): Update file tests to provide better messages. Do not try to get symbols from a file that is the file in the current buffer. * ede/base.el (ede-project-placeholder): Add more documentation to :file slot. (ede-load-cache): Use `insert-file-contents' instead of `find-file-noselect' in order to avoid activating other tools. * semantic/bovine/c.el (semantic-get-local-variables): Also add a new variable 'this' if we are in an inline member function. For detecting this, we check overlays at point if there is a class spanning the current function. Also, the variable 'this' has to be a pointer. * semantic/bovine/gcc.el (semantic-gcc-setup): Fail gracefully when querying g++ for defines returns an error. * srecode/srt-mode.el: * srecode/compile.el: * semantic/elp.el: * semantic/db-el.el: * semantic/complete.el: * ede.el: * cogre.el: * srecode/table.el: * srecode/mode.el: * srecode/insert.el: * srecode/compile.el: * semantic/decorate/include.el: * semantic/db.el: * semantic/adebug.el: * ede/auto.el: * srecode/dictionary.el: * semantic/ede-grammar.el: * semantic/db.el: * semantic/db-find.el: * semantic/db-file.el: * semantic/complete.el: * semantic/bovine/c.el: * semantic/analyze.el: * ede/util.el: * ede/proj.el: * ede/proj-elisp.el: * ede/pconf.el: * ede/locate.el: * ede.el: Adapt to EIEIO namespace cleanup: Rename `object-name' to `eieio-object-name', `object-set-name-string' to `eieio-object-set-name-string', `object-class' to `eieio-object-class', `class-parent' to `eieio-class-parent', `class-parents' to `eieio-class-parents', `class-children' to `eieio-class-children', `object-name-string' to `eieio-object-name-string', `object-class-fast' to `eieio--object-class'. Also replace direct access with new accessor functions. * ede/cpp-root.el (ede-project-autoload, initialize-instance): Fix EDE file symbol to match rename. Fix ede-cpp-root symbol to include -project in name. * cedet-files.el (cedet-files-list-recursively): New function. Recursively find files whose names are matching to given regex * ede.el (ede-current-project): Rewrite to avoid imperative style. * ede/files.el (ede-find-file): Simplify code. * ede/base.el (ede-normalize-file/directory): Add function to normalize :file or :directory slots if they are missing. * ede/cpp-root.el (ede-cpp-root-project): Add compile-command slot. (project-compile-project): Compiles project using value specified in :compule-command slot or in compile-command local variable. Value of slot or local variable could be string or function that receives project and should return string that will be invoked as command. (project-compile-target): Invokes compilation of whole project * ede/files.el (ede-find-project-root): New function to find root of project that contains specific file. (ede-files-find-existing): New function which checks presence of given directory in the list of registered projects. etc/ * srecode/ede-autoconf.srt: Change Copyright to FSF. (ede-empty): Change AC_INIT to use PROJECT_NAME, and PROJECT_VERSION. * srecode/ede-make.srt (ede-empty): Add a dependency on :project. Add header comment specifying the project's relative path. * srecode/c.srt (header_guard): Upcase the filename symbol. * srecode/java.srt (empty-main): New. (class-tag): Decapitalize class.
Diffstat (limited to 'lisp/cedet/srecode')
-rw-r--r--lisp/cedet/srecode/args.el24
-rw-r--r--lisp/cedet/srecode/compile.el10
-rw-r--r--lisp/cedet/srecode/cpp.el3
-rw-r--r--lisp/cedet/srecode/dictionary.el8
-rw-r--r--lisp/cedet/srecode/insert.el4
-rw-r--r--lisp/cedet/srecode/java.el21
-rw-r--r--lisp/cedet/srecode/map.el3
-rw-r--r--lisp/cedet/srecode/mode.el2
-rw-r--r--lisp/cedet/srecode/srt-mode.el6
-rw-r--r--lisp/cedet/srecode/srt.el6
-rw-r--r--lisp/cedet/srecode/table.el2
11 files changed, 68 insertions, 21 deletions
diff --git a/lisp/cedet/srecode/args.el b/lisp/cedet/srecode/args.el
index b91f96f611d..d6798f7523d 100644
--- a/lisp/cedet/srecode/args.el
+++ b/lisp/cedet/srecode/args.el
@@ -157,6 +157,30 @@ do not contain any text from preceding or following text."
(srecode-dictionary-show-section dict "RCS")
)))
+;;; :project ARGUMENT HANDLING
+;;
+;; When the :project argument is required, fill the dictionary with
+;; information that the current project (from EDE) might know
+(defun srecode-semantic-handle-:project (dict)
+ "Add macros into the dictionary DICT based on the current ede project."
+ (let* ((bfn (buffer-file-name))
+ (dir (file-name-directory bfn)))
+ (if (ede-toplevel)
+ (let* ((projecttop (ede-toplevel-project default-directory))
+ (relfname (file-relative-name bfn projecttop))
+ (reldir (file-relative-name dir projecttop))
+ )
+ (srecode-dictionary-set-value dict "PROJECT_FILENAME" relfname)
+ (srecode-dictionary-set-value dict "PROJECT_DIRECTORY" reldir)
+ (srecode-dictionary-set-value dict "PROJECT_NAME" (ede-name (ede-toplevel)))
+ (srecode-dictionary-set-value dict "PROJECT_VERSION" (oref (ede-toplevel) :version))
+ )
+ ;; If there is no EDE project, then put in some base values.
+ (srecode-dictionary-set-value dict "PROJECT_FILENAME" bfn)
+ (srecode-dictionary-set-value dict "PROJECT_DIRECTORY" dir)
+ (srecode-dictionary-set-value dict "PROJECT_NAME" "N/A")
+ (srecode-dictionary-set-value dict "PROJECT_VERSION" "1.0"))))
+
;;; :system ARGUMENT HANDLING
;;
;; When a :system argument is required, fill the dictionary with
diff --git a/lisp/cedet/srecode/compile.el b/lisp/cedet/srecode/compile.el
index 170b99c1fd2..0d68036c433 100644
--- a/lisp/cedet/srecode/compile.el
+++ b/lisp/cedet/srecode/compile.el
@@ -510,12 +510,12 @@ to the inserter constructor."
;;(message "Compile: %s %S" name props)
(if (not key)
(apply 'srecode-template-inserter-variable name props)
- (let ((classes (class-children srecode-template-inserter))
+ (let ((classes (eieio-class-children srecode-template-inserter))
(new nil))
;; Loop over the various subclasses and
;; create the correct inserter.
(while (and (not new) classes)
- (setq classes (append classes (class-children (car classes))))
+ (setq classes (append classes (eieio-class-children (car classes))))
;; Do we have a match?
(when (and (not (class-abstract-p (car classes)))
(equal (oref (car classes) key) key))
@@ -594,7 +594,7 @@ A list of defined variables VARS provides a variable table."
(defmethod srecode-dump ((tmp srecode-template))
"Dump the contents of the SRecode template tmp."
(princ "== Template \"")
- (princ (object-name-string tmp))
+ (princ (eieio-object-name-string tmp))
(princ "\" in context ")
(princ (oref tmp context))
(princ "\n")
@@ -640,12 +640,12 @@ Argument INDENT specifies the indentation level for the list."
(defmethod srecode-dump ((ins srecode-template-inserter) indent)
"Dump the state of the SRecode template inserter INS."
(princ "INS: \"")
- (princ (object-name-string ins))
+ (princ (eieio-object-name-string ins))
(when (oref ins :secondname)
(princ "\" : \"")
(princ (oref ins :secondname)))
(princ "\" type \"")
- (let* ((oc (symbol-name (object-class ins)))
+ (let* ((oc (symbol-name (eieio-object-class ins)))
(junk (string-match "srecode-template-inserter-" oc))
(on (if junk
(substring oc (match-end 0))
diff --git a/lisp/cedet/srecode/cpp.el b/lisp/cedet/srecode/cpp.el
index 94b394a1631..fd500b6d9a3 100644
--- a/lisp/cedet/srecode/cpp.el
+++ b/lisp/cedet/srecode/cpp.el
@@ -70,8 +70,7 @@ HEADER - Shown section if in a header file."
(srecode-dictionary-show-section dict "NOTHEADER"))
;; Strip out bad characters
- (while (string-match "\\.\\| " fsym)
- (setq fsym (replace-match "_" t t fsym)))
+ (setq fsym (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" fsym))
(srecode-dictionary-set-value dict "FILENAME_SYMBOL" fsym)
)
)
diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el
index bac05666726..bbc791f09d8 100644
--- a/lisp/cedet/srecode/dictionary.el
+++ b/lisp/cedet/srecode/dictionary.el
@@ -175,7 +175,7 @@ associated with a buffer or parent."
((srecode-dictionary-child-p buffer-or-parent)
(setq parent buffer-or-parent
buffer (oref buffer-or-parent buffer)
- origin (concat (object-name buffer-or-parent) " in "
+ origin (concat (eieio-object-name buffer-or-parent) " in "
(if buffer (buffer-name buffer)
"no buffer")))
(when buffer
@@ -454,12 +454,12 @@ If you subclass `srecode-dictionary-compound-value' then this
method could return nil, but if it does that, it must insert
the value itself using `princ', or by detecting if the current
standard out is a buffer, and using `insert'."
- (object-name cp))
+ (eieio-object-name cp))
(defmethod srecode-dump ((cp srecode-dictionary-compound-value)
&optional indent)
"Display information about this compound value."
- (princ (object-name cp))
+ (princ (eieio-object-name cp))
)
(defmethod srecode-compound-toString ((cp srecode-dictionary-compound-variable)
@@ -654,7 +654,7 @@ STATE is the current compiler state."
4)))
(while entry
(princ " --> SUBDICTIONARY ")
- (princ (object-name dict))
+ (princ (eieio-object-name dict))
(princ "\n")
(srecode-dump (car entry) newindent)
(setq entry (cdr entry))
diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el
index 466efae3b9c..0d647bb56c5 100644
--- a/lisp/cedet/srecode/insert.el
+++ b/lisp/cedet/srecode/insert.el
@@ -809,7 +809,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
(srecode-insert-report-error
dict
"Only section dictionaries allowed for `%s'"
- (object-name-string sti)))
+ (eieio-object-name-string sti)))
;; Output the code from the sub-template.
(srecode-insert-method (slot-value sti slot) dict))
@@ -866,7 +866,7 @@ Return the remains of INPUT."
(let* ((out (srecode-compile-split-code tag input STATE
(oref ins :object-name))))
(oset ins template (srecode-template
- (object-name-string ins)
+ (eieio-object-name-string ins)
:context nil
:args nil
:code (cdr out)))
diff --git a/lisp/cedet/srecode/java.el b/lisp/cedet/srecode/java.el
index db4d2deee28..29a8465c45c 100644
--- a/lisp/cedet/srecode/java.el
+++ b/lisp/cedet/srecode/java.el
@@ -42,9 +42,24 @@ FILENAME_AS_CLASS - file converted to a Java class name."
)
(while (string-match "\\.\\| " fpak)
(setq fpak (replace-match "_" t t fpak)))
- (if (string-match "src/" dir)
- (setq dir (substring dir (match-end 0)))
- (setq dir (file-name-nondirectory (directory-file-name dir))))
+ ;; 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))
+ (while (and (not res)
+ (setq pth (expand-file-name (car pths))))
+ (when (string-match pth dir)
+ (setq res (substring dir (match-end 0))))
+ (setq pths (cdr pths)))
+ (setq dir res)))
+ ;; 2) a simple heuristic
+ ((string-match "src/" dir)
+ (setq dir (substring dir (match-end 0))))
+ ;; 3) outer directory as a fallback
+ (t (setq dir (file-name-nondirectory (directory-file-name dir)))))
(setq dir (directory-file-name dir))
(while (string-match "/" dir)
(setq dir (replace-match "." t t dir)))
diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el
index cbe602f3299..1dd9ba4cf47 100644
--- a/lisp/cedet/srecode/map.el
+++ b/lisp/cedet/srecode/map.el
@@ -363,6 +363,9 @@ Return non-nil if the map changed."
(let ((semantic-init-hook nil))
(semantic-new-buffer-fcn))
)
+ ;; Force semantic to be enabled in this buffer.
+ (unless (semantic-active-p)
+ (semantic-new-buffer-fcn))
(semantic-fetch-tags)
(let* ((mode-tag
diff --git a/lisp/cedet/srecode/mode.el b/lisp/cedet/srecode/mode.el
index 8c4a53ec891..e8e1c78198e 100644
--- a/lisp/cedet/srecode/mode.el
+++ b/lisp/cedet/srecode/mode.el
@@ -225,7 +225,7 @@ MENU-DEF is the menu to bind this into."
(ctxtcons (assoc ctxt alltabs))
(bind (if (slot-boundp temp 'binding)
(oref temp binding)))
- (name (object-name-string temp)))
+ (name (eieio-object-name-string temp)))
(when (not ctxtcons)
(if (string= context ctxt)
diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el
index 455895c003d..2f43dc3872b 100644
--- a/lisp/cedet/srecode/srt-mode.el
+++ b/lisp/cedet/srecode/srt-mode.el
@@ -187,7 +187,7 @@ we can tell font lock about them.")
"Keymap used in srecode mode.")
;;;###autoload
-(define-derived-mode srecode-template-mode fundamental-mode "SRecorder"
+(define-derived-mode srecode-template-mode fundamental-mode "SRecode"
"Major-mode for writing SRecode macros."
(set (make-local-variable 'comment-start) ";;")
(set (make-local-variable 'comment-end) "")
@@ -232,7 +232,7 @@ we can tell font lock about them.")
"Provide help for working with macros in a template."
(interactive)
(let* ((root 'srecode-template-inserter)
- (chl (aref (class-v root) class-children))
+ (chl (eieio--class-children (class-v root)))
(ess (srecode-template-get-escape-start))
(ees (srecode-template-get-escape-end))
)
@@ -248,7 +248,7 @@ we can tell font lock about them.")
(showexample t)
)
(setq chl (cdr chl))
- (setq chl (append (aref (class-v C) class-children) chl))
+ (setq chl (append (eieio--class-children (class-v C)) chl))
(catch 'skip
(when (eq C 'srecode-template-inserter-section-end)
diff --git a/lisp/cedet/srecode/srt.el b/lisp/cedet/srecode/srt.el
index 3875246cb37..1fad31dafd6 100644
--- a/lisp/cedet/srecode/srt.el
+++ b/lisp/cedet/srecode/srt.el
@@ -69,6 +69,7 @@ DEFAULT is the default if RET is hit."
nil initial (or hist 'srecode-read-major-mode-history))
)
+;;;###autoload
(defun srecode-semantic-handle-:srt (dict)
"Add macros into the dictionary DICT based on the current SRT file.
Adds the following:
@@ -104,4 +105,9 @@ MODE - The mode of this buffer. If not declared yet, guess."
(provide 'srecode/srt)
+;; Local variables:
+;; generated-autoload-file: "loaddefs.el"
+;; generated-autoload-load-name: "srecode/srt"
+;; End:
+
;;; srecode/srt.el ends here
diff --git a/lisp/cedet/srecode/table.el b/lisp/cedet/srecode/table.el
index 802740ba063..26163bd1e51 100644
--- a/lisp/cedet/srecode/table.el
+++ b/lisp/cedet/srecode/table.el
@@ -251,7 +251,7 @@ Use PREDICATE is the same as for the `sort' function."
(defmethod srecode-dump ((tab srecode-template-table))
"Dump the contents of the SRecode template table TAB."
(princ "Template Table for ")
- (princ (object-name-string tab))
+ (princ (eieio-object-name-string tab))
(princ "\nPriority: ")
(prin1 (oref tab :priority))
(when (oref tab :application)