comparison lisp/cedet/srecode/find.el @ 110531:67ff8ad45bd5

Synch SRecode to CEDET 1.0. * lisp/cedet/cedet.el (cedet-version): * lisp/cedet/srecode.el (srecode-version): Bump version to 1.0. * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay): If pulse-flag is 'never, disable all pulsing. * lisp/cedet/srecode/compile.el (srecode-compile-templates): Fix directory compare of built-in templates. Give built-ins lower piority. Support special variable "project". (srecode-compile-template-table): Set :project slot of new tables. (srecode-compile-one-template-tag): Use srecode-create-dictionaries-from-tags. * lisp/cedet/srecode/cpp.el (srecode-cpp): New defgroup. (srecode-cpp-namespaces): New option. (srecode-semantic-handle-:using-namespaces) (srecode-cpp-apply-templates): New functions. (srecode-semantic-apply-tag-to-dict): Handle template parameters by calling `srecode-cpp-apply-templates'. * lisp/cedet/srecode/dictionary.el (srecode-dictionary-add-template-table): Do not add variables in tables not for the current project. (srecode-compound-toString): Handle cases where the default value is another compound value. (srecode-dictionary-lookup-name): New optional argument NON-RECURSIVE, which inhibits visiting dictionary parents. (srecode-dictionary-add-section-dictionary) (srecode-dictionary-merge): New optional argument FORCE adds values even if an identically named entry exists. (srecode-dictionary-add-entries): New method. (srecode-create-dictionaries-from-tags): New function. * lisp/cedet/srecode/fields.el (srecode-fields-exit-confirmation): New option. (srecode-field-exit-ask): Use it. * lisp/cedet/srecode/find.el (srecode-template-get-table) (srecode-template-get-table-for-binding) (srecode-all-template-hash): Skip if not in current project. (srecode-template-table-in-project-p): New method. * lisp/cedet/srecode/getset.el (srecode-insert-getset): Force tag table update. Don't query the class if it is empty. * lisp/cedet/srecode/insert.el (srecode-insert-fcn): Merge template dictionary before resolving arguments. (srecode-insert-method-helper): Add error checking to make sure that we only have dictionaries. (srecode-insert-method): Check template nesting depth when using point inserter override. (srecode-insert-method): Install override with depth limit. * lisp/cedet/srecode/map.el (srecode-map-update-map): Make map loading more robust. * lisp/cedet/srecode/mode.el (srecode-bind-insert): Call srecode-load-tables-for-mode. (srecode-minor-mode-templates-menu): Do not list templates that are not in the current project. (srecode-menu-bar): Add binding for srecode-macro-help. * lisp/cedet/srecode/table.el (srecode-template-table): Add :project slot. (srecode-dump): Dump it. * lisp/cedet/srecode/texi.el (srecode-texi-insert-tag-as-doc): New function. (semantic-insert-foreign-tag): Use it.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 21 Sep 2010 18:11:23 -0400
parents 1d1d5d9bd884
children 376148b31b5e
comparison
equal deleted inserted replaced
110530:2d0eee1a24b9 110531:67ff8ad45bd5
90 (when (or (not mt) (not (srecode-mode-table-find mt (car f)))) 90 (when (or (not mt) (not (srecode-mode-table-find mt (car f))))
91 (srecode-compile-file (car f))) 91 (srecode-compile-file (car f)))
92 )) 92 ))
93 )) 93 ))
94 94
95 ;;; PROJECT
96 ;;
97 ;; Find if a template table has a project set, and if so, is the
98 ;; current buffer in that project.
99 (defmethod srecode-template-table-in-project-p ((tab srecode-template-table))
100 "Return non-nil if the table TAB can be used in the current project.
101 If TAB has a :project set, check that the directories match.
102 If TAB is nil, then always return t."
103 (let ((proj (oref tab :project)))
104 ;; Return t if the project wasn't set.
105 (if (not proj) t
106 ;; If the project directory was set, lets check it.
107 (let ((dd (expand-file-name default-directory))
108 (projexp (regexp-quote (directory-file-name proj))))
109 (if (string-match (concat "^" projexp) dd)
110 t nil)))))
111
95 ;;; SEARCH 112 ;;; SEARCH
96 ;; 113 ;;
97 ;; Find a given template based on name, and features of the current 114 ;; Find a given template based on name, and features of the current
98 ;; buffer. 115 ;; buffer.
99 (defmethod srecode-template-get-table ((tab srecode-template-table) 116 (defmethod srecode-template-get-table ((tab srecode-template-table)
101 context application) 118 context application)
102 "Find in the template in table TAB, the template with TEMPLATE-NAME. 119 "Find in the template in table TAB, the template with TEMPLATE-NAME.
103 Optional argument CONTEXT specifies that the template should part 120 Optional argument CONTEXT specifies that the template should part
104 of a particular context. 121 of a particular context.
105 The APPLICATION argument is unused." 122 The APPLICATION argument is unused."
106 (if context 123 (when (srecode-template-table-in-project-p tab)
107 ;; If a context is specified, then look it up there. 124 (if context
108 (let ((ctxth (gethash context (oref tab contexthash)))) 125 ;; If a context is specified, then look it up there.
109 (when ctxth 126 (let ((ctxth (gethash context (oref tab contexthash))))
110 (gethash template-name ctxth))) 127 (when ctxth
111 ;; No context, perhaps a merged name? 128 (gethash template-name ctxth)))
112 (gethash template-name (oref tab namehash)))) 129 ;; No context, perhaps a merged name?
130 (gethash template-name (oref tab namehash)))))
113 131
114 (defmethod srecode-template-get-table ((tab srecode-mode-table) 132 (defmethod srecode-template-get-table ((tab srecode-mode-table)
115 template-name &optional 133 template-name &optional
116 context application) 134 context application)
117 "Find in the template in mode table TAB, the template with TEMPLATE-NAME. 135 "Find in the template in mode table TAB, the template with TEMPLATE-NAME.
142 (defmethod srecode-template-get-table-for-binding 160 (defmethod srecode-template-get-table-for-binding
143 ((tab srecode-template-table) binding &optional context) 161 ((tab srecode-template-table) binding &optional context)
144 "Find in the template name in table TAB, the template with BINDING. 162 "Find in the template name in table TAB, the template with BINDING.
145 Optional argument CONTEXT specifies that the template should part 163 Optional argument CONTEXT specifies that the template should part
146 of a particular context." 164 of a particular context."
147 (let* ((keyout nil) 165 (when (srecode-template-table-in-project-p tab)
148 (hashfcn (lambda (key value) 166 (let* ((keyout nil)
149 (when (and (slot-boundp value 'binding) 167 (hashfcn (lambda (key value)
150 (oref value binding) 168 (when (and (slot-boundp value 'binding)
151 (= (aref (oref value binding) 0) binding)) 169 (oref value binding)
152 (setq keyout key)))) 170 (= (aref (oref value binding) 0) binding))
153 (contextstr (cond ((listp context) 171 (setq keyout key))))
154 (car-safe context)) 172 (contextstr (cond ((listp context)
155 ((stringp context) 173 (car-safe context))
156 context) 174 ((stringp context)
157 (t nil))) 175 context)
158 ) 176 (t nil)))
159 (if context 177 )
160 (let ((ctxth (gethash contextstr (oref tab contexthash)))) 178 (if context
161 (when ctxth 179 (let ((ctxth (gethash contextstr (oref tab contexthash))))
162 ;; If a context is specified, then look it up there. 180 (when ctxth
163 (maphash hashfcn ctxth) 181 ;; If a context is specified, then look it up there.
164 ;; Context hashes EXCLUDE the context prefix which 182 (maphash hashfcn ctxth)
165 ;; we need to include, so concat it here 183 ;; Context hashes EXCLUDE the context prefix which
166 (when keyout 184 ;; we need to include, so concat it here
167 (setq keyout (concat contextstr ":" keyout))) 185 (when keyout
168 ))) 186 (setq keyout (concat contextstr ":" keyout)))
169 (when (not keyout) 187 )))
170 ;; No context, or binding in context. Try full hash. 188 (when (not keyout)
171 (maphash hashfcn (oref tab namehash))) 189 ;; No context, or binding in context. Try full hash.
172 keyout)) 190 (maphash hashfcn (oref tab namehash)))
191 keyout)))
173 192
174 (defmethod srecode-template-get-table-for-binding 193 (defmethod srecode-template-get-table-for-binding
175 ((tab srecode-mode-table) binding &optional context application) 194 ((tab srecode-mode-table) binding &optional context application)
176 "Find in the template name in mode table TAB, the template with BINDING. 195 "Find in the template name in mode table TAB, the template with BINDING.
177 Optional argument CONTEXT specifies a context a particular template 196 Optional argument CONTEXT specifies a context a particular template
218 (let* ((mt (srecode-get-mode-table mmode)) 237 (let* ((mt (srecode-get-mode-table mmode))
219 (tabs (when mt (oref mt :tables))) 238 (tabs (when mt (oref mt :tables)))
220 ) 239 )
221 (while tabs 240 (while tabs
222 ;; Exclude templates for a perticular application. 241 ;; Exclude templates for a perticular application.
223 (when (not (oref (car tabs) :application)) 242 (when (and (not (oref (car tabs) :application))
243 (srecode-template-table-in-project-p (car tabs)))
224 (maphash (lambda (key temp) 244 (maphash (lambda (key temp)
225 (puthash key temp mhash) 245 (puthash key temp mhash)
226 ) 246 )
227 (oref (car tabs) namehash))) 247 (oref (car tabs) namehash)))
228 (setq tabs (cdr tabs))) 248 (setq tabs (cdr tabs)))