Commit b9749554 authored by Eric M. Ludlam's avatar Eric M. Ludlam Committed by Chong Yidong

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.
parent fbb3da77
2010-09-21 Eric Ludlam <zappo@gnu.org>
* srecode/java.srt: Make NAME be a prompt.
2010-08-22 Alex Harsanyi <harsanyi@mac.com> (tiny change)
* emacs3.py: Import imp module and use it (Bug#5756).
......
......@@ -83,7 +83,7 @@ public Class {{?NAME}} {{#PARENTS}}{{#FIRST}}extends {{/FIRST}}{{#NOTFIRST}}impl
template include :blank
"An include statement."
----
import {{NAME}};
import {{?NAME}};
----
context misc
......
2010-09-21 Eric Ludlam <zappo@gnu.org>
Synch SRecode to CEDET 1.0.
* pulse.el (pulse-momentary-highlight-overlay): If pulse-flag is
'never, disable all pulsing.
* cedet.el (cedet-version):
* srecode.el (srecode-version): Bump version to 1.0.
* srecode/texi.el (srecode-texi-insert-tag-as-doc): New function.
(semantic-insert-foreign-tag): Use it.
* 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.
* srecode/table.el (srecode-template-table): Add :project slot.
(srecode-dump): Dump it.
* srecode/map.el (srecode-map-update-map): Make map loading more
robust.
* 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.
* srecode/getset.el (srecode-insert-getset): Force tag table
update. Don't query the class if it is empty.
* 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.
* srecode/fields.el (srecode-fields-exit-confirmation): New option.
(srecode-field-exit-ask): Use it.
* 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.
* 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'.
* 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.
2010-09-21 Eric Ludlam <zappo@gnu.org>
Synch EDE to CEDET 1.0.
......
......@@ -36,19 +36,19 @@
(declare-function inversion-find-version "inversion")
(defconst cedet-version "1.0pre7"
(defconst cedet-version "1.0"
"Current version of CEDET.")
(defconst cedet-packages
`(
;;PACKAGE MIN-VERSION
(cedet ,cedet-version)
(eieio "1.2")
(semantic "2.0pre7")
(srecode "1.0pre7")
(ede "1.0pre7")
(speedbar "1.0.3"))
"Table of CEDET packages to install.")
(eieio "1.3")
(semantic "2.0")
(srecode "1.0")
(ede "1.0")
(speedbar "1.0"))
"Table of CEDET packages installed.")
(defvar cedet-menu-map ;(make-sparse-keymap "CEDET menu")
(let ((map (make-sparse-keymap "CEDET menu")))
......
......@@ -3,6 +3,7 @@
;;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <eric@siege-engine.com>
;; Version: 1.0
;; This file is part of GNU Emacs.
......@@ -57,10 +58,14 @@
(error nil)))
(defcustom pulse-flag (pulse-available-p)
"*Non-nil means to pulse the overlay face for momentary highlighting.
Pulsing involves a bright highlight that slowly shifts to the background
color. Non-nil just means to highlight with an unchanging color for a short
time.
"Whether to use pulsing for momentary highlighting.
Pulsing involves a bright highlight that slowly shifts to the
background color.
If the value is nil, highlight with an unchanging color until a
key is pressed.
If the value is `never', do no coloring at all.
Any other value means to the default pulsing behavior.
If `pulse-flag' is non-nil, but `pulse-available-p' is nil, then
this flag is ignored."
......@@ -178,22 +183,23 @@ Be sure to call `pulse-reset-face' after calling pulse."
Optional argument FACE specifies the fact to do the highlighting."
(overlay-put o 'original-face (overlay-get o 'face))
(add-to-list 'pulse-momentary-overlay o)
(if (or (not pulse-flag) (not (pulse-available-p)))
;; Provide a face... clear on next command
(progn
(overlay-put o 'face (or face 'pulse-highlight-start-face))
(add-hook 'pre-command-hook
'pulse-momentary-unhighlight)
)
;; pulse it.
(unwind-protect
(if (eq pulse-flag 'never)
nil
(if (or (not pulse-flag) (not (pulse-available-p)))
;; Provide a face... clear on next command
(progn
(overlay-put o 'face 'pulse-highlight-face)
;; The pulse function puts FACE onto 'pulse-highlight-face.
;; Thus above we put our face on the overlay, but pulse
;; with a reference face needed for the color.
(pulse face))
(pulse-momentary-unhighlight))))
(overlay-put o 'face (or face 'pulse-highlight-start-face))
(add-hook 'pre-command-hook
'pulse-momentary-unhighlight))
;; pulse it.
(unwind-protect
(progn
(overlay-put o 'face 'pulse-highlight-face)
;; The pulse function puts FACE onto 'pulse-highlight-face.
;; Thus above we put our face on the overlay, but pulse
;; with a reference face needed for the color.
(pulse face))
(pulse-momentary-unhighlight)))))
(defun pulse-momentary-unhighlight ()
"Unhighlight a line recently highlighted."
......
......@@ -40,7 +40,7 @@
(require 'mode-local)
(load "srecode/loaddefs" nil 'nomessage)
(defvar srecode-version "1.0pre7"
(defvar srecode-version "1.0"
"Current version of the Semantic Recoder.")
;;; Code:
......
......@@ -35,19 +35,17 @@
(require 'semantic)
(require 'eieio)
(require 'eieio-base)
(require 'srecode)
(require 'srecode/table)
(require 'srecode/dictionary)
(declare-function srecode-template-inserter-newline-child-p "srecode/insert"
t t)
(declare-function srecode-create-section-dictionary "srecode/dictionary")
(declare-function srecode-dictionary-compound-variable "srecode/dictionary")
;;; Code:
;;; Template Class
;;
;; Templatets describe a patter of text that can be inserted into a
;; Templates describe a pattern of text that can be inserted into a
;; buffer.
;;
(defclass srecode-template (eieio-named)
......@@ -213,6 +211,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
(mode nil)
(application nil)
(priority nil)
(project nil)
(vars nil)
)
......@@ -256,6 +255,8 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
(setq application (read firstvalue)))
((string= name "priority")
(setq priority (read firstvalue)))
((string= name "project")
(setq project firstvalue))
(t
;; Assign this into some table of variables.
(setq vars (cons (cons name firstvalue) vars))
......@@ -297,12 +298,19 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
;; Calculate priority
;;
(if (not priority)
(let ((d (file-name-directory (buffer-file-name)))
(sd (file-name-directory (locate-library "srecode")))
(defaultdelta (if (eq mode 'default) 20 0)))
(if (string= d sd)
(setq priority (+ 80 defaultdelta))
(setq priority (+ 30 defaultdelta)))
(let ((d (expand-file-name (file-name-directory (buffer-file-name))))
(sd (expand-file-name (file-name-directory (locate-library "srecode"))))
(defaultdelta (if (eq mode 'default) 0 10)))
;; @TODO : WHEN INTEGRATING INTO EMACS
;; The location of Emacs default templates needs to be specified
;; here to also have a lower priority.
(if (string-match (concat "^" sd) d)
(setq priority (+ 30 defaultdelta))
;; If the user created template is for a project, then
;; don't add as much as if it is unique to just some user.
(if (stringp project)
(setq priority (+ 50 defaultdelta))
(setq priority (+ 80 defaultdelta))))
(message "Templates %s has estimated priority of %d"
(file-name-nondirectory (buffer-file-name))
priority))
......@@ -311,56 +319,56 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
priority))
;; Save it up!
(srecode-compile-template-table table mode priority application vars)
(srecode-compile-template-table table mode priority application project vars)
)
)
(defun srecode-compile-one-template-tag (tag STATE)
"Compile a template tag TAG into an srecode template class.
STATE is the current compile state as an object `srecode-compile-state'."
(require 'srecode/dictionary)
(let* ((context (oref STATE context))
(codeout (srecode-compile-split-code
tag (semantic-tag-get-attribute tag :code)
STATE))
(code (cdr codeout))
(args (semantic-tag-function-arguments tag))
(binding (semantic-tag-get-attribute tag :binding))
(rawdicts (semantic-tag-get-attribute tag :dictionaries))
(sdicts (srecode-create-section-dictionary rawdicts STATE))
(addargs nil)
)
; (message "Compiled %s to %d codes with %d args and %d prompts."
; (semantic-tag-name tag)
; (length code)
; (length args)
; (length prompts))
(while args
(setq addargs (cons (intern (car args)) addargs))
(when (eq (car addargs) :blank)
;; If we have a wrap, then put wrap inserters on both
;; ends of the code.
(setq code (append
(list (srecode-compile-inserter "BLANK"
"\r"
STATE
:secondname nil
:where 'begin))
code
(list (srecode-compile-inserter "BLANK"
"\r"
STATE
:secondname nil
:where 'end))
)))
(setq args (cdr args)))
(defun srecode-compile-one-template-tag (tag state)
"Compile a template tag TAG into a srecode template object.
STATE is the current compile state as an object of class
`srecode-compile-state'."
(let* ((context (oref state context))
(code (cdr (srecode-compile-split-code
tag (semantic-tag-get-attribute tag :code)
state)))
(args (semantic-tag-function-arguments tag))
(binding (semantic-tag-get-attribute tag :binding))
(dict-tags (semantic-tag-get-attribute tag :dictionaries))
(root-dict (when dict-tags
(srecode-create-dictionaries-from-tags
dict-tags state)))
(addargs))
;; Examine arguments.
(dolist (arg args)
(let ((symbol (intern arg)))
(push symbol addargs)
;; If we have a wrap, then put wrap inserters on both ends of
;; the code.
(when (eq symbol :blank)
(setq code (append
(list (srecode-compile-inserter
"BLANK"
"\r"
state
:secondname nil
:where 'begin))
code
(list (srecode-compile-inserter
"BLANK"
"\r"
state
:secondname nil
:where 'end)))))))
;; Construct and return the template object.
(srecode-template (semantic-tag-name tag)
:context context
:args (nreverse addargs)
:dictionary sdicts
:binding binding
:code code)
))
:context context
:args (nreverse addargs)
:dictionary root-dict
:binding binding
:code code))
)
(defun srecode-compile-do-hard-newline-p (comp)
"Examine COMP to decide if the upcoming newline should be hard.
......@@ -514,12 +522,13 @@ to the inserter constructor."
(if (not new) (error "SRECODE: Unknown macro code %S" key))
new)))
(defun srecode-compile-template-table (templates mode priority application vars)
(defun srecode-compile-template-table (templates mode priority application project vars)
"Compile a list of TEMPLATES into an semantic recode table.
The table being compiled is for MODE, or the string \"default\".
PRIORITY is a numerical value that indicates this tables location
in an ordered search.
APPLICATION is the name of the application these templates belong to.
PROJECT is a directory name which these templates scope to.
A list of defined variables VARS provides a variable table."
(let ((namehash (make-hash-table :test 'equal
:size (length templates)))
......@@ -549,6 +558,9 @@ A list of defined variables VARS provides a variable table."
(setq lp (cdr lp))))
(when (stringp project)
(setq project (expand-file-name project)))
(let* ((table (srecode-mode-table-new mode (buffer-file-name)
:templates (nreverse templates)
:namehash namehash
......@@ -556,7 +568,8 @@ A list of defined variables VARS provides a variable table."
:variables vars
:major-mode mode
:priority priority
:application application))
:application application
:project project))
(tmpl (oref table templates)))
;; Loop over all the templates, and xref.
(while tmpl
......
......@@ -26,6 +26,27 @@
;;; Code:
(require 'srecode)
(require 'srecode/dictionary)
(require 'srecode/semantic)
(require 'semantic/tag)
;;; Customization
;;
(defgroup srecode-cpp nil
"C++-specific Semantic Recoder settings."
:group 'srecode)
(defcustom srecode-cpp-namespaces
'("std" "boost")
"List expansion candidates for the :using-namespaces argument.
A dictionary entry of the named PREFIX_NAMESPACE with the value
NAMESPACE:: is created for each namespace unless the current
buffer contains a using NAMESPACE; statement "
:group 'srecode-cpp
:type '(repeat string))
;;; :cpp ARGUMENT HANDLING
;;
;; When a :cpp argument is required, fill the dictionary with
......@@ -33,10 +54,6 @@
;;
;; Error if not in a C++ mode.
(require 'srecode)
(require 'srecode/dictionary)
(require 'srecode/semantic)
;;;###autoload
(defun srecode-semantic-handle-:cpp (dict)
"Add macros into the dictionary DICT based on the current c++ file.
......@@ -59,6 +76,23 @@ HEADER - Shown section if in a header file."
)
)
(defun srecode-semantic-handle-:using-namespaces (dict)
"Add macros into the dictionary DICT based on used namespaces.
Adds the following:
PREFIX_NAMESPACE - for each NAMESPACE in `srecode-cpp-namespaces'."
(let ((tags (semantic-find-tags-by-class
'using (semantic-fetch-tags))))
(dolist (name srecode-cpp-namespaces)
(let ((variable (format "PREFIX_%s" (upcase name)))
(prefix (format "%s::" name)))
(srecode-dictionary-set-value dict variable prefix)
(dolist (tag tags)
(when (and (eq (semantic-tag-get-attribute tag :kind)
'namespace)
(string= (semantic-tag-name tag) name))
(srecode-dictionary-set-value dict variable ""))))))
)
(define-mode-local-override srecode-semantic-apply-tag-to-dict
c++-mode (tag-wrapper dict)
"Apply C++ specific features from TAG-WRAPPER into DICT.
......@@ -97,6 +131,7 @@ special behavior for tag of classes include, using and function."
(srecode-semantic-tag (semantic-tag-name value-tag)
:prime value-tag)
value-dict))
;; Discriminate using statements referring to namespaces and
;; types.
(when (eq (semantic-tag-get-attribute tag :kind) 'namespace)
......@@ -111,7 +146,8 @@ special behavior for tag of classes include, using and function."
;; when they make sense. My best bet would be
;; (semantic-tag-function-parent tag), but it is not there, when
;; the function is defined in the scope of a class.
(let ((member 't)
(let ((member t)
(templates (semantic-tag-get-attribute tag :template))
(modifiers (semantic-tag-modifiers tag)))
;; Add modifiers into the dictionary
......@@ -120,6 +156,9 @@ special behavior for tag of classes include, using and function."
dict "MODIFIERS")))
(srecode-dictionary-set-value modifier-dict "NAME" modifier)))
;; Add templates into child dictionaries.
(srecode-cpp-apply-templates dict templates)
;; When the function is a member function, it can have
;; additional modifiers.
(when member
......@@ -133,11 +172,40 @@ special behavior for tag of classes include, using and function."
;; entry.
(when (semantic-tag-get-attribute tag :pure-virtual-flag)
(srecode-dictionary-show-section dict "PURE"))
)
))
)))
;;
;; CLASS
;;
((eq class 'type)
;; For classes, add template parameters.
(when (or (semantic-tag-of-type-p tag "class")
(semantic-tag-of-type-p tag "struct"))
;; Add templates into child dictionaries.
(let ((templates (semantic-tag-get-attribute tag :template)))
(srecode-cpp-apply-templates dict templates))))
))
)
;;; Helper functions
;;
(defun srecode-cpp-apply-templates (dict templates)
"Add section dictionaries for TEMPLATES to DICT."
(when templates
(let ((templates-dict (srecode-dictionary-add-section-dictionary
dict "TEMPLATES")))
(dolist (template templates)
(let ((template-dict (srecode-dictionary-add-section-dictionary
templates-dict "ARGS")))
(srecode-semantic-apply-tag-to-dict
(srecode-semantic-tag (semantic-tag-name template)
:prime template)
template-dict)))))
)
(provide 'srecode/cpp)
;; Local variables:
......
This diff is collapsed.
......@@ -35,6 +35,8 @@
;; Each field has 2 overlays. The second overlay allows control in
;; the character just after the field, but does not highlight it.
;; @TODO - Cancel an old field array if a new one is about to be created!
;; Keep this library independent of SRecode proper.
(require 'eieio)
......@@ -43,6 +45,10 @@
"While inserting a set of fields, collect in this variable.
Once an insertion set is done, these fields will be activated.")
;;; Customization
;;
(defface srecode-field-face
'((((class color) (background dark))
(:underline "green"))
......@@ -51,6 +57,11 @@ Once an insertion set is done, these fields will be activated.")
"*Face used to specify editable fields from a template."
:group 'semantic-faces)
(defcustom srecode-fields-exit-confirmation nil
"Ask for confirmation before leaving field editing mode."
:group 'srecode
:type 'boolean)
;;; BASECLASS
;;
;; Fields and the template region share some basic overlay features.
......@@ -237,7 +248,7 @@ If SET-TO is a string, then replace the text of OLAID wit SET-TO."
(remove-hook 'post-command-hook 'srecode-field-post-command t)
(if (srecode-point-in-region-p ar)
nil ;; Keep going
;; We moved out of the temlate. Cancel the edits.
;; We moved out of the template. Cancel the edits.
(srecode-delete ar)))
))
......@@ -429,7 +440,8 @@ PRE-LEN is used in the after mode for the length of the changed text."
(defun srecode-field-exit-ask ()
"Ask if the user wants to exit field-editing mini-mode."
(interactive)
(when (y-or-n-p "Exit field-editing mode? ")
(when (or (not srecode-fields-exit-confirmation)
(y-or-n-p "Exit field-editing mode? "))
(srecode-delete (srecode-active-template-region))))
......
......@@ -92,6 +92,23 @@ all template files for that application will be loaded."
))
))
;;; PROJECT
;;
;; Find if a template table has a project set, and if so, is the
;; current buffer in that project.
(defmethod srecode-template-table-in-project-p ((tab srecode-template-table))
"Return non-nil if the table TAB can be used in the current project.
If TAB has a :project set, check that the directories match.
If TAB is nil, then always return t."
(let ((proj (oref tab :project)))
;; Return t if the project wasn't set.
(if (not proj) t
;; If the project directory was set, lets check it.
(let ((dd (expand-file-name default-directory))
(projexp (regexp-quote (directory-file-name proj))))
(if (string-match (concat "^" projexp) dd)
t nil)))))
;;; SEARCH
;;
;; Find a given template based on name, and features of the current
......@@ -103,13 +120,14 @@ all template files for that application will be loaded."
Optional argument CONTEXT specifies that the template should part
of a particular context.
The APPLICATION argument is unused."
(if context
;; If a context is specified, then look it up there.
(let ((ctxth (gethash context (oref tab contexthash))))
(when ctxth
(gethash template-name ctxth)))
;; No context, perhaps a merged name?
(gethash template-name (oref tab namehash))))
(when (srecode-template-table-in-project-p tab)
(if context
;; If a context is specified, then look it up there.
(let ((ctxth (gethash context (oref tab contexthash))))
(when ctxth
(gethash template-name ctxth)))
;; No context, perhaps a merged name?
(gethash template-name (oref tab namehash)))))
(defmethod srecode-template-get-table ((tab srecode-mode-table)
template-name &optional
......@@ -144,32 +162,33 @@ tables that do not belong to an application will be searched."
"Find in the template name in table TAB, the template with BINDING.
Optional argument CONTEXT specifies that the template should part
of a particular context."
(let* ((keyout nil)
(hashfcn (lambda (key value)
(when (and (slot-boundp value 'binding)
(oref value binding)
(= (aref (oref value binding) 0) binding))
(setq keyout key))))
(contextstr (cond ((listp context)
(car-safe context))
((stringp context)
context)
(t nil)))
)
(if context
(let ((ctxth (gethash contextstr (oref tab contexthash))))
(when ctxth
;; If a context is specified, then look it up there.
(maphash hashfcn ctxth)
;; Context hashes EXCLUDE the context prefix which
;; we need to include, so concat it here
(when keyout
(setq keyout (concat contextstr ":" keyout)))
)))
(when (not keyout)
;; No context, or binding in context. Try full hash.
(maphash hashfcn (oref tab namehash)))
keyout))
(when (srecode-template-table-in-project-p tab)
(let* ((keyout nil)
(hashfcn (lambda (key value)
(when (and (slot-boundp value 'binding)
(oref value binding)
(= (aref (oref value binding) 0) binding))
(setq keyout key))))
(contextstr (cond ((listp context)
(car-safe context))
((stringp context)
context)
(t nil)))
)
(if context
(let ((ctxth (gethash contextstr (oref tab contexthash))))
(when ctxth
;; If a context is specified, then look it up there.
(maphash hashfcn ctxth)
;; Context hashes EXCLUDE the context prefix which
;; we need to include, so concat it here
(when keyout
(setq keyout (concat contextstr ":" keyout)))
)))
(when (not keyout)
;; No context, or binding in context. Try full hash.
(maphash hashfcn (oref tab namehash)))
keyout)))
(defmethod srecode-template-get-table-for-binding
((tab srecode-mode-table) binding &optional context application)
......@@ -220,7 +239,8 @@ Optional argument HASH is the hash table to fill in."
)
(while tabs
;; Exclude templates for a perticular application.
(when (not (oref (car tabs) :application))
(when (and (not (oref (car tabs) :application))