summaryrefslogtreecommitdiff
path: root/lisp/cedet/srecode
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/cedet/srecode')
-rw-r--r--lisp/cedet/srecode/args.el6
-rw-r--r--lisp/cedet/srecode/compile.el25
-rw-r--r--lisp/cedet/srecode/cpp.el4
-rw-r--r--lisp/cedet/srecode/ctxt.el7
-rw-r--r--lisp/cedet/srecode/dictionary.el25
-rw-r--r--lisp/cedet/srecode/document.el2
-rw-r--r--lisp/cedet/srecode/el.el4
-rw-r--r--lisp/cedet/srecode/expandproto.el2
-rw-r--r--lisp/cedet/srecode/extract.el18
-rw-r--r--lisp/cedet/srecode/fields.el2
-rw-r--r--lisp/cedet/srecode/filters.el2
-rw-r--r--lisp/cedet/srecode/find.el24
-rw-r--r--lisp/cedet/srecode/getset.el2
-rw-r--r--lisp/cedet/srecode/insert.el103
-rw-r--r--lisp/cedet/srecode/java.el2
-rw-r--r--lisp/cedet/srecode/map.el13
-rw-r--r--lisp/cedet/srecode/mode.el107
-rw-r--r--lisp/cedet/srecode/semantic.el9
-rw-r--r--lisp/cedet/srecode/srt-mode.el24
-rw-r--r--lisp/cedet/srecode/srt.el3
-rw-r--r--lisp/cedet/srecode/table.el28
-rw-r--r--lisp/cedet/srecode/texi.el4
22 files changed, 189 insertions, 227 deletions
diff --git a/lisp/cedet/srecode/args.el b/lisp/cedet/srecode/args.el
index e8a1a2c2153..086f369b7f2 100644
--- a/lisp/cedet/srecode/args.el
+++ b/lisp/cedet/srecode/args.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -174,8 +174,8 @@ do not contain any text from preceding or following text."
(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))
- )
+ (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)
diff --git a/lisp/cedet/srecode/compile.el b/lisp/cedet/srecode/compile.el
index d2e2807b248..80b267b8c23 100644
--- a/lisp/cedet/srecode/compile.el
+++ b/lisp/cedet/srecode/compile.el
@@ -31,7 +31,6 @@
;; The output are a series of EIEIO objects which represent the
;; templates in a way that could be inserted later.
-(eval-when-compile (require 'cl))
(require 'semantic)
(require 'eieio)
(require 'cl-generic)
@@ -132,18 +131,6 @@ STATE is the current compilation state."
"For the template inserter INS, apply information from STATE."
nil)
-(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter))
- escape-start escape-end)
- "Insert an example using inserter INS.
-Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
- (princ " ")
- (princ escape-start)
- (when (and (slot-exists-p ins 'key) (oref ins key))
- (princ (format "%c" (oref ins key))))
- (princ "VARNAME")
- (princ escape-end)
- (terpri)
- )
;;; Compile State
@@ -547,8 +534,8 @@ A list of defined variables VARS provides a variable table."
(while lp
- (let* ((objname (oref (car lp) :object-name))
- (context (oref (car lp) :context))
+ (let* ((objname (oref (car lp) object-name))
+ (context (oref (car lp) context))
(globalname (concat context ":" objname))
)
@@ -583,7 +570,7 @@ A list of defined variables VARS provides a variable table."
(tmpl (oref table templates)))
;; Loop over all the templates, and xref.
(while tmpl
- (oset (car tmpl) :table table)
+ (oset (car tmpl) table table)
(setq tmpl (cdr tmpl))))
))
@@ -629,7 +616,7 @@ Argument INDENT specifies the indentation level for the list."
(princ ") ")
(cond ((stringp (car code))
(prin1 (car code)))
- ((srecode-template-inserter-child-p (car code))
+ ((cl-typep (car code) 'srecode-template-inserter)
(srecode-dump (car code) indent))
(t
(princ "Unknown Code: ")
@@ -644,9 +631,9 @@ Argument INDENT specifies the indentation level for the list."
"Dump the state of the SRecode template inserter INS."
(princ "INS: \"")
(princ (eieio-object-name-string ins))
- (when (oref ins :secondname)
+ (when (oref ins secondname)
(princ "\" : \"")
- (princ (oref ins :secondname)))
+ (princ (oref ins secondname)))
(princ "\" type \"")
(let* ((oc (symbol-name (eieio-object-class ins)))
(junk (string-match "srecode-template-inserter-" oc))
diff --git a/lisp/cedet/srecode/cpp.el b/lisp/cedet/srecode/cpp.el
index e6a55992336..306c60f1b61 100644
--- a/lisp/cedet/srecode/cpp.el
+++ b/lisp/cedet/srecode/cpp.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Jan Moringen <scymtym@users.sourceforge.net>
;; This file is part of GNU Emacs.
@@ -122,7 +122,7 @@ specified in a C file."
(srecode-semantic-apply-tag-to-dict-default tag-wrapper dict)
;; Pull out the tag for the individual pieces.
- (let* ((tag (oref tag-wrapper :prime))
+ (let* ((tag (oref tag-wrapper prime))
(class (semantic-tag-class tag)))
;; Add additional information based on the class of the tag.
diff --git a/lisp/cedet/srecode/ctxt.el b/lisp/cedet/srecode/ctxt.el
index 66f67790a9f..b20b9bc6417 100644
--- a/lisp/cedet/srecode/ctxt.el
+++ b/lisp/cedet/srecode/ctxt.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -32,9 +32,7 @@
(require 'semantic)
(require 'semantic/tag-ls)
-
-(declare-function srecode-dictionary-show-section "srecode/dictionary")
-(declare-function srecode-dictionary-set-value "srecode/dictionary")
+(require 'srecode/dictionary)
;;; Code:
@@ -175,7 +173,6 @@ This might add the following:
PURE - show a section if a function is pure virtual.
PARENT - The name of a parent type for functions.
PROTECTION - Show a protection section, and what the protection is."
- (require 'srecode/dictionary)
(when template
(let ((name (oref template object-name))
diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el
index 6e7887f0530..1058024d457 100644
--- a/lisp/cedet/srecode/dictionary.el
+++ b/lisp/cedet/srecode/dictionary.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -28,11 +28,11 @@
;;; CLASSES
-(eval-when-compile (require 'cl))
(require 'eieio)
(require 'cl-generic)
(require 'srecode)
(require 'srecode/table)
+(require 'srecode/fields)
(eval-when-compile (require 'semantic))
(declare-function srecode-compile-parse-inserter "srecode/compile")
@@ -42,7 +42,6 @@
(declare-function srecode-insert-code-stream "srecode/insert")
(declare-function data-debug-new-buffer "data-debug")
(declare-function data-debug-insert-object-slots "eieio-datadebug")
-(declare-function srecode-field "srecode/fields")
(defclass srecode-dictionary ()
((namehash :initarg :namehash
@@ -123,7 +122,7 @@ Makes sure that :value is compiled."
(cl-call-next-method this (nreverse newfields))
(when (not (slot-boundp this 'compiled))
- (let ((val (oref this :value))
+ (let ((val (oref this value))
(comp nil))
(while val
(let ((nval (car val))
@@ -142,7 +141,7 @@ Makes sure that :value is compiled."
(error "Don't know how to handle variable value %S" nval)))
)
(setq val (cdr val)))
- (oset this :compiled (nreverse comp))))))
+ (oset this compiled (nreverse comp))))))
;;; DICTIONARY METHODS
;;
@@ -173,7 +172,7 @@ associated with a buffer or parent."
initfrombuff t))
;; Parent is another dictionary
- ((srecode-dictionary-child-p buffer-or-parent)
+ ((cl-typep buffer-or-parent 'srecode-dictionary)
(setq parent buffer-or-parent
buffer (oref buffer-or-parent buffer)
origin (concat (eieio-object-name buffer-or-parent) " in "
@@ -224,7 +223,7 @@ TPL is an object representing a compiled template file."
;; Tables are sorted with highest priority first, useful for looking
;; up templates, but this means we need to install the variables in
;; reverse order so higher priority variables override lower ones.
- (let ((tabs (reverse (oref tpl :tables))))
+ (let ((tabs (reverse (oref tpl tables))))
(require 'srecode/find) ; For srecode-template-table-in-project-p
(while tabs
(when (srecode-template-table-in-project-p (car tabs))
@@ -357,7 +356,7 @@ values but STATE is nil."
(srecode-dictionary-set-value dict name value))
;; Value is a dictionary; insert as child dictionary.
- ((srecode-dictionary-child-p value)
+ ((cl-typep value 'srecode-dictionary)
(srecode-dictionary-merge
(srecode-dictionary-add-section-dictionary dict name)
value t))
@@ -506,7 +505,6 @@ inserted with a new editable field.")
function
dictionary)
"Convert this field into an insertable string."
- (require 'srecode/fields)
;; If we are not in a buffer, then this is not supported.
(when (not (bufferp standard-output))
(error "FIELDS invoked while inserting template to non-buffer"))
@@ -519,13 +517,13 @@ inserted with a new editable field.")
(let* ((dv (oref cp defaultvalue))
(sti (oref cp firstinserter))
(start (point))
- (name (oref sti :object-name)))
+ (name (oref sti object-name)))
(cond
;; No default value.
((not dv) (insert name))
;; A compound value as the default? Recurse.
- ((srecode-dictionary-compound-value-child-p dv)
+ ((cl-typep dv 'srecode-dictionary-compound-value)
(srecode-compound-toString dv function dictionary))
;; A string that is empty? Use the name.
((and (stringp dv) (string= dv ""))
@@ -612,10 +610,9 @@ STATE is the current compiler state."
(srecode-get-mode-table modesym))
(error "No table found for mode %S" modesym)))
(dict (srecode-create-dictionary (current-buffer)))
- (end (current-time))
)
(message "Creating a dictionary took %.2f seconds."
- (semantic-elapsed-time start end))
+ (semantic-elapsed-time start nil))
(data-debug-new-buffer "*SRECODE ADEBUG*")
(data-debug-insert-object-slots dict "*")))
@@ -662,7 +659,7 @@ STATE is the current compiler state."
))
(princ "\n")
)
- ((srecode-dictionary-compound-value-child-p entry)
+ ((cl-typep entry 'srecode-dictionary-compound-value)
(srecode-dump entry indent)
(princ "\n")
)
diff --git a/lisp/cedet/srecode/document.el b/lisp/cedet/srecode/document.el
index 06fc262f879..ad15b3ef6fd 100644
--- a/lisp/cedet/srecode/document.el
+++ b/lisp/cedet/srecode/document.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
diff --git a/lisp/cedet/srecode/el.el b/lisp/cedet/srecode/el.el
index 348c8126c8e..33b75cad692 100644
--- a/lisp/cedet/srecode/el.el
+++ b/lisp/cedet/srecode/el.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -86,7 +86,7 @@ Calls `srecode-semantic-apply-tag-to-dict-default' first."
(srecode-semantic-apply-tag-to-dict-default tagobj dict)
;; Pull out the tag for the individual pieces.
- (let* ((tag (oref tagobj :prime))
+ (let* ((tag (oref tagobj prime))
(doc (semantic-tag-docstring tag)))
;; It is much more common to have doc on ELisp.
diff --git a/lisp/cedet/srecode/expandproto.el b/lisp/cedet/srecode/expandproto.el
index 7b5de0df6dd..10e304aa153 100644
--- a/lisp/cedet/srecode/expandproto.el
+++ b/lisp/cedet/srecode/expandproto.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
diff --git a/lisp/cedet/srecode/extract.el b/lisp/cedet/srecode/extract.el
index 0086eeb6bd1..c46ff7e38f7 100644
--- a/lisp/cedet/srecode/extract.el
+++ b/lisp/cedet/srecode/extract.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -88,7 +88,7 @@ the dictionary entries were for that block of text."
(save-restriction
(narrow-to-region start end)
(let ((dict (srecode-create-dictionary t))
- (state (srecode-extract-state "state"))
+ (state (srecode-extract-state))
)
(goto-char start)
(srecode-extract-method template dict state)
@@ -161,10 +161,9 @@ Return nil as this inserter will extract nothing."
Return t if something was extracted.
Return nil if this inserter doesn't need to extract anything."
(srecode-dictionary-set-value vdict
- (oref ins :object-name)
+ (oref ins object-name)
(buffer-substring-no-properties
- start end)
- )
+ start end))
t)
;;; Section Inserter
@@ -178,10 +177,9 @@ Return nil if this inserter doesn't need to extract anything."
"Extract text from START/END and store in INDICT.
Return the starting location of the first plain-text match.
Return nil if nothing was extracted."
- (let ((name (oref ins :object-name))
+ (let ((name (oref ins object-name))
(subdict (srecode-create-dictionary indict))
- (allsubdict nil)
- )
+ (allsubdict nil))
;; Keep extracting till we can extract no more.
(while (condition-case nil
@@ -217,10 +215,10 @@ Return nil if nothing was extracted."
;; There are two modes for includes. One is with no dict,
;; so it is inserted straight. If the dict has a name, then
;; we need to run once per dictionary occurrence.
- (if (not (string= (oref ins :object-name) ""))
+ (if (not (string= (oref ins object-name) ""))
;; With a name, do the insertion.
(let ((subdict (srecode-dictionary-add-section-dictionary
- dict (oref ins :object-name))))
+ dict (oref ins object-name))))
(error "Need to implement include w/ name extractor")
;; Recurse into the new template while no errors.
(while (condition-case nil
diff --git a/lisp/cedet/srecode/fields.el b/lisp/cedet/srecode/fields.el
index 95caeb3118c..f4999827f7f 100644
--- a/lisp/cedet/srecode/fields.el
+++ b/lisp/cedet/srecode/fields.el
@@ -2,7 +2,7 @@
;;
;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
;;
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
diff --git a/lisp/cedet/srecode/filters.el b/lisp/cedet/srecode/filters.el
index b9b037fb500..2ff7594c4b0 100644
--- a/lisp/cedet/srecode/filters.el
+++ b/lisp/cedet/srecode/filters.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
diff --git a/lisp/cedet/srecode/find.el b/lisp/cedet/srecode/find.el
index 68592265e10..23680937ea8 100644
--- a/lisp/cedet/srecode/find.el
+++ b/lisp/cedet/srecode/find.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -27,8 +27,7 @@
(require 'srecode/ctxt)
(require 'srecode/table)
(require 'srecode/map)
-
-(declare-function srecode-compile-file "srecode/compile")
+(require 'srecode/compile)
;;; Code:
@@ -58,7 +57,6 @@ Templates are found in the SRecode Template Map.
See `srecode-get-maps' for more.
APPNAME is the name of an application. In this case,
all template files for that application will be loaded."
- (require 'srecode/compile)
(let ((files
(if appname
(apply 'append
@@ -100,7 +98,7 @@ all template files for that application will be loaded."
"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)))
+ (let ((proj (oref tab project)))
;; Return t if the project wasn't set.
(if (not proj) t
;; If the project directory was set, let's check it.
@@ -139,10 +137,10 @@ Optional argument APPLICATION restricts searches to only template tables
belonging to a specific application. If APPLICATION is nil, then only
tables that do not belong to an application will be searched."
(let* ((mt tab)
- (tabs (oref mt :tables))
+ (tabs (oref mt tables))
(ans nil))
(while (and (not ans) tabs)
- (let ((app (oref (car tabs) :application)))
+ (let ((app (oref (car tabs) application)))
(when (or (and (not application) (null app))
(and application (eq app application)))
(setq ans (srecode-template-get-table (car tabs) template-name
@@ -150,7 +148,7 @@ tables that do not belong to an application will be searched."
(setq tabs (cdr tabs))))
(or ans
;; Recurse to the default.
- (when (not (equal (oref tab :major-mode) 'default))
+ (when (not (equal (oref tab major-mode) 'default))
(srecode-template-get-table (srecode-get-mode-table 'default)
template-name context application)))))
@@ -199,10 +197,10 @@ Optional argument APPLICATION restricts searches to only template tables
belonging to a specific application. If APPLICATION is nil, then only
tables that do not belong to an application will be searched."
(let* ((mt tab)
- (tabs (oref mt :tables))
+ (tabs (oref mt tables))
(ans nil))
(while (and (not ans) tabs)
- (let ((app (oref (car tabs) :application)))
+ (let ((app (oref (car tabs) application)))
(when (or (and (not application) (null app))
(and application (eq app application)))
(setq ans (srecode-template-get-table-for-binding
@@ -210,7 +208,7 @@ tables that do not belong to an application will be searched."
(setq tabs (cdr tabs))))
(or ans
;; Recurse to the default.
- (when (not (equal (oref tab :major-mode) 'default))
+ (when (not (equal (oref tab major-mode) 'default))
(srecode-template-get-table-for-binding
(srecode-get-mode-table 'default) binding context)))))
;;; Interactive
@@ -241,10 +239,10 @@ templates."
;; Load up the hash table for our current mode.
(let* ((mt (srecode-get-mode-table mmode))
- (tabs (when mt (oref mt :tables))))
+ (tabs (when mt (oref mt tables))))
(dolist (tab tabs)
;; Exclude templates for a particular application.
- (when (and (not (oref tab :application))
+ (when (and (not (oref tab application))
(srecode-template-table-in-project-p tab))
(maphash (lambda (key temp)
(when (or (not predicate)
diff --git a/lisp/cedet/srecode/getset.el b/lisp/cedet/srecode/getset.el
index cef4b9435b2..e5740964a49 100644
--- a/lisp/cedet/srecode/getset.el
+++ b/lisp/cedet/srecode/getset.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el
index 26af2ffe2ef..966cd485e82 100644
--- a/lisp/cedet/srecode/insert.el
+++ b/lisp/cedet/srecode/insert.el
@@ -1,4 +1,4 @@
-;;; srecode/insert.el --- Insert srecode templates to an output stream.
+;;; srecode/insert.el --- Insert srecode templates to an output stream -*- lexical-binding:t -*-
;; Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.
@@ -26,9 +26,6 @@
;; Manage the insertion process for a template.
;;
-(eval-when-compile
- (require 'cl)) ;; for `lexical-let'
-
(require 'srecode/compile)
(require 'srecode/find)
(require 'srecode/dictionary)
@@ -186,8 +183,7 @@ Buffer based features related to change hooks is handled one level up."
)
(let ((reg
;; Create the field-driven editable area.
- (srecode-template-inserted-region
- "TEMPLATE" :start start :end (point))))
+ (srecode-template-inserted-region :start start :end (point))))
(srecode-overlaid-activate reg))
)
;; We return with 'point being the end of the template insertion
@@ -467,19 +463,18 @@ If SECONDNAME is nil, return VALUE."
(srecode-insert-report-error
dictionary
"Variable inserter %s: second argument `%s' is not a function"
- (object-print sti) secondname)))
+ (cl-prin1-to-string sti) secondname)))
value))
(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-variable)
dictionary)
"Insert the STI inserter."
;; Convert the name into a name/fcn pair
- (let* ((name (oref sti :object-name))
- (fcnpart (oref sti :secondname))
+ (let* ((name (oref sti object-name))
+ (fcnpart (oref sti secondname))
(val (srecode-dictionary-lookup-name
dictionary name))
- (do-princ t)
- )
+ (do-princ t))
;; Alert if a macro wasn't found.
(when (not val)
(message "Warning: macro %S was not found in the dictionary." name)
@@ -548,12 +543,12 @@ Loop over the prompts to see if we have a match."
)
(while prompts
(when (string= (semantic-tag-name (car prompts))
- (oref ins :object-name))
- (oset ins :prompt
+ (oref ins object-name))
+ (oset ins prompt
(semantic-tag-get-attribute (car prompts) :text))
- (oset ins :defaultfcn
+ (oset ins defaultfcn
(semantic-tag-get-attribute (car prompts) :default))
- (oset ins :read-fcn
+ (oset ins read-fcn
(or (semantic-tag-get-attribute (car prompts) :read)
'read-string))
)
@@ -564,7 +559,7 @@ Loop over the prompts to see if we have a match."
dictionary)
"Insert the STI inserter."
(let ((val (srecode-dictionary-lookup-name
- dictionary (oref sti :object-name))))
+ dictionary (oref sti object-name))))
(if val
;; Does some extra work. Oh well.
(cl-call-next-method)
@@ -580,7 +575,7 @@ Loop over the prompts to see if we have a match."
;; the user can use the same name again later.
(srecode-dictionary-set-value
(srecode-root-dictionary dictionary)
- (oref sti :object-name) val)
+ (oref sti object-name) val)
;; Now that this value is safely stowed in the dictionary,
;; we can do what regular inserters do.
@@ -590,7 +585,7 @@ Loop over the prompts to see if we have a match."
dictionary)
"Derive the default value for an askable inserter STI.
DICTIONARY is used to derive some values."
- (let ((defaultfcn (oref sti :defaultfcn)))
+ (let ((defaultfcn (oref sti defaultfcn)))
(cond
((stringp defaultfcn)
defaultfcn)
@@ -617,13 +612,13 @@ DICTIONARY is used to derive some values."
Use DICTIONARY to resolve values."
(let* ((prompt (oref sti prompt))
(default (srecode-insert-ask-default sti dictionary))
- (reader (oref sti :read-fcn))
+ (reader (oref sti read-fcn))
(val nil)
)
(cond ((eq reader 'y-or-n-p)
(if (y-or-n-p (or prompt
(format "%s? "
- (oref sti :object-name))))
+ (oref sti object-name))))
(setq val default)
(setq val "")))
((eq reader 'read-char)
@@ -631,14 +626,14 @@ Use DICTIONARY to resolve values."
"%c"
(read-char (or prompt
(format "Char for %s: "
- (oref sti :object-name))))))
+ (oref sti object-name))))))
)
(t
(save-excursion
(setq val (funcall reader
(or prompt
(format "Specify %s: "
- (oref sti :object-name)))
+ (oref sti object-name)))
default
)))))
;; Return our derived value.
@@ -651,7 +646,7 @@ Use DICTIONARY to resolve values."
Use DICTIONARY to resolve values."
(let* ((default (srecode-insert-ask-default sti dictionary))
(compound-value
- (srecode-field-value (oref sti :object-name)
+ (srecode-field-value (oref sti object-name)
:firstinserter sti
:defaultvalue default))
)
@@ -819,12 +814,12 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
Loops over the embedded CODE which was saved here during compilation.
The template to insert is stored in SLOT."
(let ((dicts (srecode-dictionary-lookup-name
- dictionary (oref sti :object-name))))
+ dictionary (oref sti object-name))))
(when (not (listp dicts))
(srecode-insert-report-error
dictionary
"Cannot insert section %S from non-section variable."
- (oref sti :object-name)))
+ (oref sti object-name)))
;; If there is no section dictionary, then don't output anything
;; from this section.
(while dicts
@@ -832,7 +827,7 @@ The template to insert is stored in SLOT."
(srecode-insert-report-error
dictionary
"Cannot insert section %S from non-section variable."
- (oref sti :object-name)))
+ (oref sti object-name)))
(srecode-insert-subtemplate sti (car dicts) slot)
(setq dicts (cdr dicts)))))
@@ -863,7 +858,7 @@ applied to the text between the section start and the
Shorten input until the END token is found.
Return the remains of INPUT."
(let* ((out (srecode-compile-split-code tag input STATE
- (oref ins :object-name))))
+ (oref ins object-name))))
(oset ins template (srecode-template
(eieio-object-name-string ins)
:context nil
@@ -896,7 +891,7 @@ are treated specially.")
(cl-defmethod srecode-match-end ((ins srecode-template-inserter-section-end) name)
"For the template inserter INS, do I end a section called NAME?"
- (string= name (oref ins :object-name)))
+ (string= name (oref ins object-name)))
(defclass srecode-template-inserter-include (srecode-template-inserter-subtemplate)
((key :initform ?>
@@ -927,13 +922,13 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
"For the template inserter STI, lookup the template to include.
Finds the template with this macro function part and stores it in
this template instance."
- (let ((templatenamepart (oref sti :secondname)))
+ (let ((templatenamepart (oref sti secondname)))
;; If there was no template name, throw an error.
(unless templatenamepart
(srecode-insert-report-error
dictionary
"Include macro `%s' needs a template name"
- (oref sti :object-name)))
+ (oref sti object-name)))
;; NOTE: We used to cache the template and not look it up a second time,
;; but changes in the template tables can change which template is
@@ -971,14 +966,14 @@ this template instance."
)
;; Store the found template into this object for later use.
- (oset sti :includedtemplate tmpl))
+ (oset sti includedtemplate tmpl))
(unless (oref sti includedtemplate)
;; @todo - Call into a debugger to help find the template in question.
(srecode-insert-report-error
dictionary
"No template \"%s\" found for include macro `%s'"
- templatenamepart (oref sti :object-name)))))
+ templatenamepart (oref sti object-name)))))
(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-include)
dictionary)
@@ -988,7 +983,7 @@ with the dictionaries found in the dictionary."
(srecode-insert-include-lookup sti dictionary)
;; Insert the template.
;; Our baseclass has a simple way to do this.
- (if (srecode-dictionary-lookup-name dictionary (oref sti :object-name))
+ (if (srecode-dictionary-lookup-name dictionary (oref sti object-name))
;; If we have a value, then call the next method
(srecode-insert-method-helper sti dictionary 'includedtemplate)
;; If we don't have a special dictionary, then just insert with the
@@ -1049,25 +1044,37 @@ template where a ^ inserter occurs."
;; which implements the wrap insertion behavior in FUNCTION. The
;; maximum valid nesting depth is just the current depth + 1.
(let ((srecode-template-inserter-point-override
- (lexical-let ((inserter1 sti))
- (cons
- ;; DEPTH
- (+ (length (oref-default 'srecode-template active)) 1)
- ;; FUNCTION
- (lambda (dict)
- (let ((srecode-template-inserter-point-override nil))
- (if (srecode-dictionary-lookup-name
- dict (oref inserter1 :object-name))
- ;; Insert our sectional part with looping.
- (srecode-insert-method-helper
- inserter1 dict 'template)
- ;; Insert our sectional part just once.
- (srecode-insert-subtemplate
- inserter1 dict 'template))))))))
+ (cons
+ ;; DEPTH
+ (+ (length (oref-default 'srecode-template active)) 1)
+ ;; FUNCTION
+ (lambda (dict)
+ (let ((srecode-template-inserter-point-override nil))
+ (if (srecode-dictionary-lookup-name
+ dict (oref sti object-name))
+ ;; Insert our sectional part with looping.
+ (srecode-insert-method-helper
+ sti dict 'template)
+ ;; Insert our sectional part just once.
+ (srecode-insert-subtemplate
+ sti dict 'template)))))))
;; Do a regular insertion for an include, but with our override in
;; place.
(cl-call-next-method)))
+(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter))
+ escape-start escape-end)
+ "Insert an example using inserter INS.
+Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use."
+ (princ " ")
+ (princ escape-start)
+ (when (and (slot-exists-p ins 'key) (oref ins key))
+ (princ (format "%c" (oref ins key))))
+ (princ "VARNAME")
+ (princ escape-end)
+ (terpri)
+ )
+
(provide 'srecode/insert)
;; Local variables:
diff --git a/lisp/cedet/srecode/java.el b/lisp/cedet/srecode/java.el
index 85df930fede..43c207e9880 100644
--- a/lisp/cedet/srecode/java.el
+++ b/lisp/cedet/srecode/java.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el
index 01ed630a66c..08ff0e6305e 100644
--- a/lisp/cedet/srecode/map.el
+++ b/lisp/cedet/srecode/map.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -224,10 +224,9 @@ Optional argument RESET forces a reset of the current map."
(require 'data-debug)
(let ((start (current-time))
(p (srecode-get-maps t)) ;; Time the reset.
- (end (current-time))
)
(message "Updating the map took %.2f seconds."
- (semantic-elapsed-time start end))
+ (semantic-elapsed-time start nil))
(data-debug-new-buffer "*SRECODE ADEBUG*")
(data-debug-insert-stuff-list p "*")))
@@ -271,7 +270,7 @@ if that file is NEW, otherwise assume the mode has not changed."
(if (not srecode-map-save-file)
;; 0) Create a MAP when in no save file mode.
(when (not srecode-current-map)
- (setq srecode-current-map (srecode-map "SRecode Map"))
+ (setq srecode-current-map (srecode-map))
(message "SRecode map created in non-save mode.")
)
@@ -291,8 +290,7 @@ if that file is NEW, otherwise assume the mode has not changed."
(error "Change your SRecode map file"))))
;; Have a dir. Make the object.
(setq srecode-current-map
- (srecode-map "SRecode Map"
- :file srecode-map-save-file)))
+ (srecode-map :file srecode-map-save-file)))
;; 2) Do we not have a current map? If so load.
(when (not srecode-current-map)
@@ -302,8 +300,7 @@ if that file is NEW, otherwise assume the mode has not changed."
(error
;; There was an error loading the old map. Create a new one.
(setq srecode-current-map
- (srecode-map "SRecode Map"
- :file srecode-map-save-file))))
+ (srecode-map :file srecode-map-save-file))))
)
)
diff --git a/lisp/cedet/srecode/mode.el b/lisp/cedet/srecode/mode.el
index c78f98bfc04..3a8fd91eb2d 100644
--- a/lisp/cedet/srecode/mode.el
+++ b/lisp/cedet/srecode/mode.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -69,62 +69,44 @@
(defvar srecode-menu-bar
(list
"SRecoder"
- (semantic-menu-item
- ["Insert Template"
- srecode-insert
- :active t
- :help "Insert a template by name."
- ])
- (semantic-menu-item
- ["Insert Template Again"
- srecode-insert-again
- :active t
- :help "Run the same template as last time again."
- ])
- (semantic-menu-item
- ["Edit Template"
- srecode-edit
- :active t
- :help "Edit a template for this language by name."
- ])
+ ["Insert Template"
+ srecode-insert
+ :active t
+ :help "Insert a template by name."]
+ ["Insert Template Again"
+ srecode-insert-again
+ :active t
+ :help "Run the same template as last time again."]
+ ["Edit Template"
+ srecode-edit
+ :active t
+ :help "Edit a template for this language by name."]
"---"
'( "Insert ..." :filter srecode-minor-mode-templates-menu )
- `( "Generate ..." :filter srecode-minor-mode-generate-menu )
+ '( "Generate ..." :filter srecode-minor-mode-generate-menu )
"---"
- (semantic-menu-item
- ["Customize..."
- (customize-group "srecode")
- :active t
- :help "Customize SRecode options"
- ])
+ ["Customize..."
+ (customize-group "srecode")
+ :active t
+ :help "Customize SRecode options"]
(list
"Debugging Tools..."
- (semantic-menu-item
- ["Dump Template MAP"
- srecode-get-maps
- :active t
- :help "Calculate (if needed) and display the current template file map."
- ])
- (semantic-menu-item
- ["Dump Tables"
- srecode-dump-templates
- :active t
- :help "Dump the current template table."
- ])
- (semantic-menu-item
- ["Dump Dictionary"
- srecode-dictionary-dump
- :active t
- :help "Calculate and dump a dictionary for point."
- ])
- (semantic-menu-item
- ["Show Macro Help"
- srecode-macro-help
- :active t
- :help "Display the different types of macros available."
- ])
- )
- )
+ ["Dump Template MAP"
+ srecode-get-maps
+ :active t
+ :help "Calculate (if needed) and display the current template file map."]
+ ["Dump Tables"
+ srecode-dump-templates
+ :active t
+ :help "Dump the current template table."]
+ ["Dump Dictionary"
+ srecode-dictionary-dump
+ :active t
+ :help "Calculate and dump a dictionary for point."]
+ ["Show Macro Help"
+ srecode-macro-help
+ :active t
+ :help "Display the different types of macros available."]))
"Menu for srecode minor mode.")
(defvar srecode-minor-menu nil
@@ -148,10 +130,10 @@
;;;###autoload
(define-minor-mode srecode-minor-mode
"Toggle srecode minor mode.
-With prefix argument ARG, turn on if positive, otherwise off. The
-minor mode can be turned on only if semantic feature is available and
-the current buffer was set up for parsing. Return non-nil if the
-minor mode is enabled.
+
+The minor mode can be turned on only if semantic feature is
+available and the current buffer was set up for parsing. Return
+non-nil if the minor mode is enabled.
\\{srecode-mode-map}"
:keymap srecode-mode-map
@@ -176,8 +158,7 @@ minor mode is enabled.
;;;###autoload
(define-minor-mode global-srecode-minor-mode
- "Toggle global use of srecode minor mode.
-If ARG is positive or nil, enable, if it is negative, disable."
+ "Toggle global use of srecode minor mode."
:global t :group 'srecode
;; Not needed because it's autoloaded instead.
;; :require 'srecode/mode
@@ -196,7 +177,7 @@ MENU-DEF is the menu to bind this into."
;;(srecode-load-tables-for-mode major-mode)
(let* ((modetable (srecode-get-mode-table major-mode))
- (subtab (when modetable (oref modetable :tables)))
+ (subtab (when modetable (oref modetable tables)))
(context nil)
(active nil)
(ltab nil)
@@ -319,17 +300,17 @@ Template is chosen based on the mode of the starting buffer."
(if (not temp)
(error "No Template named %s" template-name))
;; We need a template specific table, since tables chain.
- (let ((tab (oref temp :table))
+ (let ((tab (oref temp table))
(names nil)
)
- (find-file (oref tab :file))
- (setq names (semantic-find-tags-by-name (oref temp :object-name)
+ (find-file (oref tab file))
+ (setq names (semantic-find-tags-by-name (oref temp object-name)
(current-buffer)))
(cond ((= (length names) 1)
(semantic-go-to-tag (car names))
(semantic-momentary-highlight-tag (car names)))
((> (length names) 1)
- (let* ((ctxt (semantic-find-tags-by-name (oref temp :context)
+ (let* ((ctxt (semantic-find-tags-by-name (oref temp context)
(current-buffer)))
(cls (semantic-find-tags-by-class 'context ctxt))
)
diff --git a/lisp/cedet/srecode/semantic.el b/lisp/cedet/srecode/semantic.el
index 93dcaff943c..1e1a60e0245 100644
--- a/lisp/cedet/srecode/semantic.el
+++ b/lisp/cedet/srecode/semantic.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -63,10 +63,9 @@ If FUNCTION is non-nil, then FUNCTION is somehow applied to an
aspect of the compound value."
(if (not function)
;; Just format it in some handy dandy way.
- (semantic-format-tag-prototype (oref cp :prime))
+ (semantic-format-tag-prototype (oref cp prime))
;; Otherwise, apply the function to the tag itself.
- (funcall function (oref cp :prime))
- ))
+ (funcall function (oref cp prime))))
;;; Managing the `current' tag
@@ -106,7 +105,7 @@ variable default values, and other things."
(srecode-dictionary-set-value dict "TAG" tagobj)
;; Pull out the tag for the individual pieces.
- (let ((tag (oref tagobj :prime)))
+ (let ((tag (oref tagobj prime)))
(srecode-dictionary-set-value dict "NAME" (semantic-tag-name tag))
(srecode-dictionary-set-value dict "TYPE" (semantic-format-tag-type tag nil))
diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el
index df97d6e55e5..5e7c7c111a3 100644
--- a/lisp/cedet/srecode/srt-mode.el
+++ b/lisp/cedet/srecode/srt-mode.el
@@ -33,6 +33,7 @@
(declare-function srecode-create-dictionary "srecode/dictionary")
(declare-function srecode-resolve-argument-list "srecode/insert")
+(declare-function srecode-inserter-prin-example "srecode/insert")
;;; Code:
(defvar srecode-template-mode-syntax-table
@@ -64,7 +65,7 @@
(defvar srecode-font-lock-keywords
'(
;; Template
- ("^\\(template\\)\\s-+\\(\\w*\\)\\(\\( \\(:\\w+\\)\\|\\)+\\)$"
+ ("^\\(template\\)\\s-+\\(\\w*\\)\\(\\( \\(:\\w+\\)\\)*\\)$"
(1 font-lock-keyword-face)
(2 font-lock-function-name-face)
(3 font-lock-builtin-face ))
@@ -228,10 +229,12 @@ we can tell font lock about them.")
(insert ee))))
)
+(eieio-declare-slots key)
(defun srecode-macro-help ()
"Provide help for working with macros in a template."
(interactive)
+ (require 'srecode/insert)
(let* ((root 'srecode-template-inserter)
(chl (eieio-class-children root))
(ess (srecode-template-get-escape-start))
@@ -246,8 +249,7 @@ we can tell font lock about them.")
(name (symbol-name C))
(key (when (slot-exists-p C 'key)
(oref C key)))
- (showexample t)
- )
+ (showexample t))
(setq chl (cdr chl))
(setq chl (append (eieio-class-children C) chl))
@@ -494,7 +496,7 @@ section or ? for an ask variable."
(let* ((macroend (match-beginning 0))
(raw (buffer-substring-no-properties
macrostart macroend))
- (STATE (srecode-compile-state "TMP"))
+ (STATE (srecode-compile-state))
(inserter (condition-case nil
(srecode-compile-parse-inserter
raw STATE)
@@ -502,13 +504,14 @@ section or ? for an ask variable."
)
(when inserter
(let ((base
- (cons (oref inserter :object-name)
+ (cons (oref inserter object-name)
(if (and (slot-boundp inserter :secondname)
- (oref inserter :secondname))
- (split-string (oref inserter :secondname)
+ (oref inserter secondname))
+ (split-string (oref inserter secondname)
":")
nil)))
- (key (oref inserter key)))
+ (key (when (slot-exists-p inserter 'key)
+ (oref inserter key))))
(cond ((null key)
;; A plain variable
(cons nil base))
@@ -605,7 +608,6 @@ section or ? for an ask variable."
(setq context-return
(semantic-analyze-context-functionarg
- "context-for-srecode"
:buffer (current-buffer)
:scope scope
:bounds bounds
@@ -628,7 +630,7 @@ section or ? for an ask variable."
srecode-template-mode (context)
"Return a list of possible completions based on NONTEXT."
(with-current-buffer (oref context buffer)
- (let* ((prefix (car (last (oref context :prefix))))
+ (let* ((prefix (car (last (oref context prefix))))
(prefixstr (cond ((stringp prefix)
prefix)
((semantic-tag-p prefix)
@@ -639,7 +641,7 @@ section or ? for an ask variable."
; prefix)
; ((stringp (car prefix))
; (car prefix))))
- (argtype (car (oref context :argument)))
+ (argtype (car (oref context argument)))
(matches nil))
;; Depending on what the analyzer is, we have different ways
diff --git a/lisp/cedet/srecode/srt.el b/lisp/cedet/srecode/srt.el
index 0a6c732efda..dc6300ea79c 100644
--- a/lisp/cedet/srecode/srt.el
+++ b/lisp/cedet/srecode/srt.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -25,7 +25,6 @@
;;; Code:
-(eval-when-compile (require 'cl))
(require 'eieio)
(require 'srecode/dictionary)
(require 'srecode/insert)
diff --git a/lisp/cedet/srecode/table.el b/lisp/cedet/srecode/table.el
index 67e363499f4..7a0600c3f81 100644
--- a/lisp/cedet/srecode/table.el
+++ b/lisp/cedet/srecode/table.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -187,8 +187,8 @@ INIT are the initialization parameters for the new template table."
(new (apply 'srecode-template-table
(file-name-nondirectory file)
:file file
- :filesize (nth 7 attr)
- :filedate (nth 5 attr)
+ :filesize (file-attribute-size attr)
+ :filedate (file-attribute-modification-time attr)
:major-mode mode
init
)))
@@ -201,8 +201,8 @@ INIT are the initialization parameters for the new template table."
;; into the search table first, allowing lower priority items
;; to be the items found in the search table.
(object-sort-list mt 'modetables (lambda (a b)
- (> (oref a :priority)
- (oref b :priority))))
+ (> (oref a priority)
+ (oref b priority))))
;; Return it.
new))
@@ -239,9 +239,9 @@ Use PREDICATE is the same as for the `sort' function."
(cl-defmethod srecode-dump ((tab srecode-mode-table))
"Dump the contents of the SRecode mode table TAB."
(princ "MODE TABLE FOR ")
- (princ (oref tab :major-mode))
+ (princ (oref tab major-mode))
(princ "\n--------------------------------------------\n\nNumber of tables: ")
- (let ((subtab (oref tab :tables)))
+ (let ((subtab (oref tab tables)))
(princ (length subtab))
(princ "\n\n")
(while subtab
@@ -254,17 +254,17 @@ Use PREDICATE is the same as for the `sort' function."
(princ "Template Table for ")
(princ (eieio-object-name-string tab))
(princ "\nPriority: ")
- (prin1 (oref tab :priority))
- (when (oref tab :application)
+ (prin1 (oref tab priority))
+ (when (oref tab application)
(princ "\nApplication: ")
- (princ (oref tab :application)))
- (when (oref tab :framework)
+ (princ (oref tab application)))
+ (when (oref tab framework)
(princ "\nFramework: ")
- (princ (oref tab :framework)))
- (when (oref tab :project)
+ (princ (oref tab framework)))
+ (when (oref tab project)
(require 'srecode/find) ; For srecode-template-table-in-project-p
(princ "\nProject Directory: ")
- (princ (oref tab :project))
+ (princ (oref tab project))
(when (not (srecode-template-table-in-project-p tab))
(princ "\n ** Not Usable in this file. **")))
(princ "\n\nVariables:\n")
diff --git a/lisp/cedet/srecode/texi.el b/lisp/cedet/srecode/texi.el
index 223cf28e12c..bb2b7c91316 100644
--- a/lisp/cedet/srecode/texi.el
+++ b/lisp/cedet/srecode/texi.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
-;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Author: Eric M. Ludlam <zappo@gnu.org>
;; This file is part of GNU Emacs.
@@ -156,7 +156,7 @@ Adds the following:
(error "No tag to insert for :texitag template argument"))
;; Extract the tag out of the compound object.
- (setq tag (oref tag :prime))
+ (setq tag (oref tag prime))
;; Extract the doc string
(setq doc (semantic-documentation-for-tag tag))