diff options
Diffstat (limited to 'lisp/cedet/srecode')
-rw-r--r-- | lisp/cedet/srecode/args.el | 24 | ||||
-rw-r--r-- | lisp/cedet/srecode/compile.el | 10 | ||||
-rw-r--r-- | lisp/cedet/srecode/cpp.el | 3 | ||||
-rw-r--r-- | lisp/cedet/srecode/dictionary.el | 8 | ||||
-rw-r--r-- | lisp/cedet/srecode/insert.el | 4 | ||||
-rw-r--r-- | lisp/cedet/srecode/java.el | 21 | ||||
-rw-r--r-- | lisp/cedet/srecode/map.el | 3 | ||||
-rw-r--r-- | lisp/cedet/srecode/mode.el | 2 | ||||
-rw-r--r-- | lisp/cedet/srecode/srt-mode.el | 6 | ||||
-rw-r--r-- | lisp/cedet/srecode/srt.el | 6 | ||||
-rw-r--r-- | lisp/cedet/srecode/table.el | 2 |
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) |