diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-02-04 13:49:49 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-02-04 13:49:49 -0500 |
commit | 73b17f7c2b723a0ad4ea04cf1a5a8be5bbdf6121 (patch) | |
tree | fc2ee663521960bf1c102bb98a72f31903e5110b /lisp/cedet/srecode | |
parent | 102a21d68976ab9dc85304e0bc47b7562d3cf93f (diff) | |
download | emacs-73b17f7c2b723a0ad4ea04cf1a5a8be5bbdf6121.tar.gz emacs-73b17f7c2b723a0ad4ea04cf1a5a8be5bbdf6121.tar.bz2 emacs-73b17f7c2b723a0ad4ea04cf1a5a8be5bbdf6121.zip |
* lisp/cedet: Use cl-generic instead of EIEIO's defgeneric/defmethod
* lisp/cedet/**/*.el: Mechanically replace all calls to defmethod/defgeneric
by calls to cl-defmethod/cl-defgeneric.
* lisp/cedet/srecode/table.el:
* lisp/cedet/srecode/fields.el:
* lisp/cedet/srecode/dictionary.el:
* lisp/cedet/srecode/compile.el:
* lisp/cedet/semantic/debug.el:
* lisp/cedet/semantic/db-ref.el:
* lisp/cedet/ede/base.el:
* lisp/cedet/ede/auto.el:
* lisp/cedet/ede.el: Require `cl-generic'.
Diffstat (limited to 'lisp/cedet/srecode')
-rw-r--r-- | lisp/cedet/srecode/compile.el | 15 | ||||
-rw-r--r-- | lisp/cedet/srecode/dictionary.el | 35 | ||||
-rw-r--r-- | lisp/cedet/srecode/extract.el | 24 | ||||
-rw-r--r-- | lisp/cedet/srecode/fields.el | 43 | ||||
-rw-r--r-- | lisp/cedet/srecode/find.el | 10 | ||||
-rw-r--r-- | lisp/cedet/srecode/insert.el | 82 | ||||
-rw-r--r-- | lisp/cedet/srecode/map.el | 18 | ||||
-rw-r--r-- | lisp/cedet/srecode/semantic.el | 2 | ||||
-rw-r--r-- | lisp/cedet/srecode/table.el | 7 |
9 files changed, 120 insertions, 116 deletions
diff --git a/lisp/cedet/srecode/compile.el b/lisp/cedet/srecode/compile.el index 782121ef5b5..c93a6f72a9a 100644 --- a/lisp/cedet/srecode/compile.el +++ b/lisp/cedet/srecode/compile.el @@ -34,6 +34,7 @@ (eval-when-compile (require 'cl)) (require 'semantic) (require 'eieio) +(require 'cl-generic) (require 'eieio-base) (require 'srecode/table) (require 'srecode/dictionary) @@ -115,7 +116,7 @@ additional static argument data.")) Plain text strings are not handled via this baseclass." :abstract t) -(defmethod srecode-parse-input ((ins srecode-template-inserter) +(cl-defmethod srecode-parse-input ((ins srecode-template-inserter) tag input STATE) "For the template inserter INS, parse INPUT. Shorten input only by the amount needed. @@ -123,15 +124,15 @@ Return the remains of INPUT. STATE is the current compilation state." input) -(defmethod srecode-match-end ((ins srecode-template-inserter) name) +(cl-defmethod srecode-match-end ((ins srecode-template-inserter) name) "For the template inserter INS, do I end a section called NAME?" nil) -(defmethod srecode-inserter-apply-state ((ins srecode-template-inserter) STATE) +(cl-defmethod srecode-inserter-apply-state ((ins srecode-template-inserter) STATE) "For the template inserter INS, apply information from STATE." nil) -(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter) +(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." @@ -158,7 +159,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." ) "Current state of the compile.") -(defmethod srecode-compile-add-prompt ((state srecode-compile-state) +(cl-defmethod srecode-compile-add-prompt ((state srecode-compile-state) prompttag) "Add PROMPTTAG to the current list of prompts." (with-slots (prompts) state @@ -595,7 +596,7 @@ A list of defined variables VARS provides a variable table." ;; Dump out information about the current srecoder compiled templates. ;; -(defmethod srecode-dump ((tmp srecode-template)) +(cl-defmethod srecode-dump ((tmp srecode-template)) "Dump the contents of the SRecode template tmp." (princ "== Template \"") (princ (eieio-object-name-string tmp)) @@ -641,7 +642,7 @@ Argument INDENT specifies the indentation level for the list." (princ "\n")))) ) -(defmethod srecode-dump ((ins srecode-template-inserter) indent) +(cl-defmethod srecode-dump ((ins srecode-template-inserter) indent) "Dump the state of the SRecode template inserter INS." (princ "INS: \"") (princ (eieio-object-name-string ins)) diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el index 9b471eb102d..97d3310a2ae 100644 --- a/lisp/cedet/srecode/dictionary.el +++ b/lisp/cedet/srecode/dictionary.el @@ -30,6 +30,7 @@ (eval-when-compile (require 'cl)) (require 'eieio) +(require 'cl-generic) (require 'srecode) (require 'srecode/table) (eval-when-compile (require 'semantic)) @@ -103,7 +104,7 @@ set NAME \"str\" macro \"OTHERNAME\" with appending various parts together in a list.") -(defmethod initialize-instance ((this srecode-dictionary-compound-variable) +(cl-defmethod initialize-instance ((this srecode-dictionary-compound-variable) &optional fields) "Initialize the compound variable THIS. Makes sure that :value is compiled." @@ -120,7 +121,7 @@ Makes sure that :value is compiled." ;;(when (not state) ;; (error "Cannot create compound variable outside of sectiondictionary")) - (call-next-method this (nreverse newfields)) + (cl-call-next-method this (nreverse newfields)) (when (not (slot-boundp this 'compiled)) (let ((val (oref this :value)) (comp nil)) @@ -215,7 +216,7 @@ associated with a buffer or parent." )) dict)))) -(defmethod srecode-dictionary-add-template-table ((dict srecode-dictionary) +(cl-defmethod srecode-dictionary-add-template-table ((dict srecode-dictionary) tpl) "Insert into DICT the variables found in table TPL. TPL is an object representing a compiled template file." @@ -235,7 +236,7 @@ TPL is an object representing a compiled template file." (setq tabs (cdr tabs)))))) -(defmethod srecode-dictionary-set-value ((dict srecode-dictionary) +(cl-defmethod srecode-dictionary-set-value ((dict srecode-dictionary) name value) "In dictionary DICT, set NAME to have VALUE." ;; Validate inputs @@ -247,7 +248,7 @@ TPL is an object representing a compiled template file." (puthash name value namehash)) ) -(defmethod srecode-dictionary-add-section-dictionary ((dict srecode-dictionary) +(cl-defmethod srecode-dictionary-add-section-dictionary ((dict srecode-dictionary) name &optional show-only force) "In dictionary DICT, add a section dictionary for section macro NAME. Return the new dictionary. @@ -299,7 +300,7 @@ inserted dictionaries." ;; Return the new sub-dictionary. new)) -(defmethod srecode-dictionary-show-section ((dict srecode-dictionary) name) +(cl-defmethod srecode-dictionary-show-section ((dict srecode-dictionary) name) "In dictionary DICT, indicate that the section NAME should be exposed." ;; Validate inputs (unless (stringp name) @@ -310,7 +311,7 @@ inserted dictionaries." (srecode-dictionary-add-section-dictionary dict name t) nil) -(defmethod srecode-dictionary-hide-section ((dict srecode-dictionary) name) +(cl-defmethod srecode-dictionary-hide-section ((dict srecode-dictionary) name) "In dictionary DICT, indicate that the section NAME should be hidden." ;; We need to find the has value, and then delete it. ;; Validate inputs @@ -322,7 +323,7 @@ inserted dictionaries." (remhash name namehash)) nil) -(defmethod srecode-dictionary-add-entries ((dict srecode-dictionary) +(cl-defmethod srecode-dictionary-add-entries ((dict srecode-dictionary) entries &optional state) "Add ENTRIES to DICT. @@ -373,7 +374,7 @@ values but STATE is nil." (setq entries (nthcdr 2 entries))) dict) -(defmethod srecode-dictionary-merge ((dict srecode-dictionary) otherdict +(cl-defmethod srecode-dictionary-merge ((dict srecode-dictionary) otherdict &optional force) "Merge into DICT the dictionary entries from OTHERDICT. Unless the optional argument FORCE is non-nil, values in DICT are @@ -405,7 +406,7 @@ OTHERDICT." (srecode-dictionary-set-value dict key entry))))) (oref otherdict namehash)))) -(defmethod srecode-dictionary-lookup-name ((dict srecode-dictionary) +(cl-defmethod srecode-dictionary-lookup-name ((dict srecode-dictionary) name &optional non-recursive) "Return information about DICT's value for NAME. DICT is a dictionary, and NAME is a string that is treated as the @@ -429,7 +430,7 @@ This function derives values for some special NAMEs, such as (srecode-dictionary-lookup-name parent name))))) ) -(defmethod srecode-root-dictionary ((dict srecode-dictionary)) +(cl-defmethod srecode-root-dictionary ((dict srecode-dictionary)) "For dictionary DICT, return the root dictionary. The root dictionary is usually for a current or active insertion." (let ((ans dict)) @@ -442,7 +443,7 @@ The root dictionary is usually for a current or active insertion." ;; Compound values must provide at least the toString method ;; for use in converting the compound value into something insertable. -(defmethod srecode-compound-toString ((cp srecode-dictionary-compound-value) +(cl-defmethod srecode-compound-toString ((cp srecode-dictionary-compound-value) function dictionary) "Convert the compound dictionary value CP to a string. @@ -456,13 +457,13 @@ the value itself using `princ', or by detecting if the current standard out is a buffer, and using `insert'." (eieio-object-name cp)) -(defmethod srecode-dump ((cp srecode-dictionary-compound-value) +(cl-defmethod srecode-dump ((cp srecode-dictionary-compound-value) &optional indent) "Display information about this compound value." (princ (eieio-object-name cp)) ) -(defmethod srecode-compound-toString ((cp srecode-dictionary-compound-variable) +(cl-defmethod srecode-compound-toString ((cp srecode-dictionary-compound-variable) function dictionary) "Convert the compound dictionary variable value CP into a string. @@ -471,7 +472,7 @@ FUNCTION and DICTIONARY are as for the baseclass." (srecode-insert-code-stream (oref cp compiled) dictionary)) -(defmethod srecode-dump ((cp srecode-dictionary-compound-variable) +(cl-defmethod srecode-dump ((cp srecode-dictionary-compound-variable) &optional indent) "Display information about this compound value." (require 'srecode/compile) @@ -501,7 +502,7 @@ Compound values allow a field to be stored in the dictionary for when it is referenced a second time. This compound value can then be inserted with a new editable field.") -(defmethod srecode-compound-toString((cp srecode-field-value) +(cl-defmethod srecode-compound-toString((cp srecode-field-value) function dictionary) "Convert this field into an insertable string." @@ -639,7 +640,7 @@ STATE is the current compiler state." (srecode-dump dict)) )))) -(defmethod srecode-dump ((dict srecode-dictionary) &optional indent) +(cl-defmethod srecode-dump ((dict srecode-dictionary) &optional indent) "Dump a dictionary." (if (not indent) (setq indent 0)) (maphash (lambda (key entry) diff --git a/lisp/cedet/srecode/extract.el b/lisp/cedet/srecode/extract.el index c3b1f6e6da1..027ae0c25dd 100644 --- a/lisp/cedet/srecode/extract.el +++ b/lisp/cedet/srecode/extract.el @@ -55,16 +55,16 @@ ) "The current extraction state.") -(defmethod srecode-extract-state-set ((st srecode-extract-state) ins dict) +(cl-defmethod srecode-extract-state-set ((st srecode-extract-state) ins dict) "Set onto the extract state ST a new inserter INS and dictionary DICT." (oset st lastinserter ins) (oset st lastdict dict)) -(defmethod srecode-extract-state-set-anchor ((st srecode-extract-state)) +(cl-defmethod srecode-extract-state-set-anchor ((st srecode-extract-state)) "Reset the anchor point on extract state ST." (oset st anchor (point))) -(defmethod srecode-extract-state-extract ((st srecode-extract-state) +(cl-defmethod srecode-extract-state-extract ((st srecode-extract-state) endpoint) "Perform an extraction on the extract state ST with ENDPOINT. If there was no waiting inserter, do nothing." @@ -94,7 +94,7 @@ the dictionary entries were for that block of text." (srecode-extract-method template dict state) dict)))) -(defmethod srecode-extract-method ((st srecode-template) dictionary +(cl-defmethod srecode-extract-method ((st srecode-template) dictionary state) "Extract template ST and store extracted text in DICTIONARY. Optional STARTRETURN is a symbol in which the start of the first @@ -139,11 +139,11 @@ Uses STATE to maintain the current extraction state." ;;; Inserter Base Extractors ;; -(defmethod srecode-inserter-do-extract-p ((ins srecode-template-inserter)) +(cl-defmethod srecode-inserter-do-extract-p ((ins srecode-template-inserter)) "Return non-nil if this inserter can extract values." nil) -(defmethod srecode-inserter-extract ((ins srecode-template-inserter) +(cl-defmethod srecode-inserter-extract ((ins srecode-template-inserter) start end dict state) "Extract text from START/END and store in DICT. Return nil as this inserter will extract nothing." @@ -151,11 +151,11 @@ Return nil as this inserter will extract nothing." ;;; Variable extractor is simple and can extract later. ;; -(defmethod srecode-inserter-do-extract-p ((ins srecode-template-inserter-variable)) +(cl-defmethod srecode-inserter-do-extract-p ((ins srecode-template-inserter-variable)) "Return non-nil if this inserter can extract values." 'later) -(defmethod srecode-inserter-extract ((ins srecode-template-inserter-variable) +(cl-defmethod srecode-inserter-extract ((ins srecode-template-inserter-variable) start end vdict state) "Extract text from START/END and store in VDICT. Return t if something was extracted. @@ -169,11 +169,11 @@ Return nil if this inserter doesn't need to extract anything." ;;; Section Inserter ;; -(defmethod srecode-inserter-do-extract-p ((ins srecode-template-inserter-section-start)) +(cl-defmethod srecode-inserter-do-extract-p ((ins srecode-template-inserter-section-start)) "Return non-nil if this inserter can extract values." 'now) -(defmethod srecode-inserter-extract ((ins srecode-template-inserter-section-start) +(cl-defmethod srecode-inserter-extract ((ins srecode-template-inserter-section-start) start end indict state) "Extract text from START/END and store in INDICT. Return the starting location of the first plain-text match. @@ -203,11 +203,11 @@ Return nil if nothing was extracted." ;;; Include Extractor must extract now. ;; -(defmethod srecode-inserter-do-extract-p ((ins srecode-template-inserter-include)) +(cl-defmethod srecode-inserter-do-extract-p ((ins srecode-template-inserter-include)) "Return non-nil if this inserter can extract values." 'now) -(defmethod srecode-inserter-extract ((ins srecode-template-inserter-include) +(cl-defmethod srecode-inserter-extract ((ins srecode-template-inserter-include) start end dict state) "Extract text from START/END and store in DICT. Return the starting location of the first plain-text match. diff --git a/lisp/cedet/srecode/fields.el b/lisp/cedet/srecode/fields.el index f473a0d8261..dd38b65d7bf 100644 --- a/lisp/cedet/srecode/fields.el +++ b/lisp/cedet/srecode/fields.el @@ -39,6 +39,7 @@ ;; Keep this library independent of SRecode proper. (require 'eieio) +(require 'cl-generic) ;;; Code: (defvar srecode-field-archive nil @@ -74,7 +75,7 @@ The overlay will crossreference this object.") "An object that gets automatically bound to an overlay. Has virtual :start and :end initializers.") -(defmethod initialize-instance ((olaid srecode-overlaid) &optional args) +(cl-defmethod initialize-instance ((olaid srecode-overlaid) &optional args) "Initialize OLAID, being sure it archived." ;; Extract :start and :end from the olaid list. (let ((newargs nil) @@ -107,11 +108,11 @@ Has virtual :start and :end initializers.") (overlay-put olay 'srecode-init-only t) (oset olaid overlay olay) - (call-next-method olaid (nreverse newargs)) + (cl-call-next-method olaid (nreverse newargs)) )) -(defmethod srecode-overlaid-activate ((olaid srecode-overlaid)) +(cl-defmethod srecode-overlaid-activate ((olaid srecode-overlaid)) "Activate the overlaid area." (let* ((ola (oref olaid overlay)) (start (overlay-start ola)) @@ -128,23 +129,23 @@ Has virtual :start and :end initializers.") )) -(defmethod srecode-delete ((olaid srecode-overlaid)) +(cl-defmethod srecode-delete ((olaid srecode-overlaid)) "Delete the overlay from OLAID." (delete-overlay (oref olaid overlay)) (slot-makeunbound olaid 'overlay) ) -(defmethod srecode-empty-region-p ((olaid srecode-overlaid)) +(cl-defmethod srecode-empty-region-p ((olaid srecode-overlaid)) "Return non-nil if the region covered by OLAID is of length 0." (= 0 (srecode-region-size olaid))) -(defmethod srecode-region-size ((olaid srecode-overlaid)) +(cl-defmethod srecode-region-size ((olaid srecode-overlaid)) "Return the length of region covered by OLAID." (let ((start (overlay-start (oref olaid overlay))) (end (overlay-end (oref olaid overlay)))) (- end start))) -(defmethod srecode-point-in-region-p ((olaid srecode-overlaid)) +(cl-defmethod srecode-point-in-region-p ((olaid srecode-overlaid)) "Return non-nil if point is in the region of OLAID." (let ((start (overlay-start (oref olaid overlay))) (end (overlay-end (oref olaid overlay)))) @@ -161,7 +162,7 @@ Has virtual :start and :end initializers.") (setq ol (cdr ol))) (car (nreverse ret)))) -(defmethod srecode-overlaid-text ((olaid srecode-overlaid) &optional set-to) +(cl-defmethod srecode-overlaid-text ((olaid srecode-overlaid) &optional set-to) "Return the text under OLAID. If SET-TO is a string, then replace the text of OLAID wit SET-TO." (let* ((ol (oref olaid overlay)) @@ -191,7 +192,7 @@ If SET-TO is a string, then replace the text of OLAID wit SET-TO." ) "Manage a buffer region in which fields exist.") -(defmethod initialize-instance ((ir srecode-template-inserted-region) +(cl-defmethod initialize-instance ((ir srecode-template-inserted-region) &rest args) "Initialize IR, capturing the active fields, and creating the overlay." ;; Fill in the fields @@ -199,10 +200,10 @@ If SET-TO is a string, then replace the text of OLAID wit SET-TO." (setq srecode-field-archive nil) ;; Initialize myself first. - (call-next-method) + (cl-call-next-method) ) -(defmethod srecode-overlaid-activate ((ir srecode-template-inserted-region)) +(cl-defmethod srecode-overlaid-activate ((ir srecode-template-inserted-region)) "Activate the template area for IR." ;; Activate all our fields @@ -210,7 +211,7 @@ If SET-TO is a string, then replace the text of OLAID wit SET-TO." (srecode-overlaid-activate F)) ;; Activate our overlay. - (call-next-method) + (cl-call-next-method) ;; Position the cursor at the first field (let ((first (car (oref ir fields)))) @@ -223,14 +224,14 @@ If SET-TO is a string, then replace the text of OLAID wit SET-TO." (add-hook 'post-command-hook 'srecode-field-post-command t t) ) -(defmethod srecode-delete ((ir srecode-template-inserted-region)) +(cl-defmethod srecode-delete ((ir srecode-template-inserted-region)) "Call into our base, but also clear out the fields." ;; Clear us out of the baseclass. (oset ir active-region nil) ;; Clear our fields. (mapc 'srecode-delete (oref ir fields)) ;; Call to our base - (call-next-method) + (cl-call-next-method) ;; Clear our hook. (remove-hook 'post-command-hook 'srecode-field-post-command t) ) @@ -285,15 +286,15 @@ Try to use this to provide useful completion when available.") km) "Keymap applied to field overlays.") -(defmethod initialize-instance ((field srecode-field) &optional args) +(cl-defmethod initialize-instance ((field srecode-field) &optional args) "Initialize FIELD, being sure it archived." (add-to-list 'srecode-field-archive field t) - (call-next-method) + (cl-call-next-method) ) -(defmethod srecode-overlaid-activate ((field srecode-field)) +(cl-defmethod srecode-overlaid-activate ((field srecode-field)) "Activate the FIELD area." - (call-next-method) + (cl-call-next-method) (let* ((ol (oref field overlay)) (end nil) @@ -314,13 +315,13 @@ Try to use this to provide useful completion when available.") ) ) -(defmethod srecode-delete ((olaid srecode-field)) +(cl-defmethod srecode-delete ((olaid srecode-field)) "Delete our secondary overlay." ;; Remove our spare overlay (delete-overlay (oref olaid tail)) (slot-makeunbound olaid 'tail) ;; Do our baseclass work. - (call-next-method) + (cl-call-next-method) ) (defvar srecode-field-replication-max-size 100 @@ -379,7 +380,7 @@ PRE-LEN is used in the after mode for the length of the changed text." (srecode-field-mod-hook ol after start end pre-len)) )) -(defmethod srecode-field-goto ((field srecode-field)) +(cl-defmethod srecode-field-goto ((field srecode-field)) "Goto the FIELD." (goto-char (overlay-start (oref field overlay)))) diff --git a/lisp/cedet/srecode/find.el b/lisp/cedet/srecode/find.el index fc1b79dfd52..092f739df7d 100644 --- a/lisp/cedet/srecode/find.el +++ b/lisp/cedet/srecode/find.el @@ -96,7 +96,7 @@ all template files for that application will be loaded." ;; ;; 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)) +(cl-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." @@ -113,7 +113,7 @@ If TAB is nil, then always return t." ;; ;; Find a given template based on name, and features of the current ;; buffer. -(defmethod srecode-template-get-table ((tab srecode-template-table) +(cl-defmethod srecode-template-get-table ((tab srecode-template-table) template-name &optional context application) "Find in the template in table TAB, the template with TEMPLATE-NAME. @@ -129,7 +129,7 @@ The APPLICATION argument is unused." ;; No context, perhaps a merged name? (gethash template-name (oref tab namehash))))) -(defmethod srecode-template-get-table ((tab srecode-mode-table) +(cl-defmethod srecode-template-get-table ((tab srecode-mode-table) template-name &optional context application) "Find in the template in mode table TAB, the template with TEMPLATE-NAME. @@ -157,7 +157,7 @@ tables that do not belong to an application will be searched." ;; ;; Find a given template based on a key binding. ;; -(defmethod srecode-template-get-table-for-binding +(cl-defmethod srecode-template-get-table-for-binding ((tab srecode-template-table) binding &optional context) "Find in the template name in table TAB, the template with BINDING. Optional argument CONTEXT specifies that the template should part @@ -190,7 +190,7 @@ of a particular context." (maphash hashfcn (oref tab namehash))) keyout))) -(defmethod srecode-template-get-table-for-binding +(cl-defmethod srecode-template-get-table-for-binding ((tab srecode-mode-table) binding &optional context application) "Find in the template name in mode table TAB, the template with BINDING. Optional argument CONTEXT specifies a context a particular template diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el index 78ec1658859..0c13ee51e34 100644 --- a/lisp/cedet/srecode/insert.el +++ b/lisp/cedet/srecode/insert.el @@ -260,20 +260,20 @@ Optional argument TEMP is the template that is getting its arguments resolved." ;; Code managing the top-level insert method and the current ;; insertion stack. ;; -(defmethod srecode-push ((st srecode-template)) +(cl-defmethod srecode-push ((st srecode-template)) "Push the srecoder template ST onto the active stack." (oset st active (cons st (oref st active)))) -(defmethod srecode-pop :STATIC ((st srecode-template)) +(cl-defmethod srecode-pop ((st (subclass srecode-template))) "Pop the srecoder template ST onto the active stack. ST can be a class, or an object." (oset st active (cdr (oref st active)))) -(defmethod srecode-peek :STATIC ((st srecode-template)) +(cl-defmethod srecode-peek ((st (subclass srecode-template))) "Fetch the topmost active template record. ST can be a class." (car (oref st active))) -(defmethod srecode-insert-method ((st srecode-template) dictionary) +(cl-defmethod srecode-insert-method ((st srecode-template) dictionary) "Insert the srecoder template ST." ;; Merge any template entries into the input dictionary. ;; This may happen twice since some templates arguments need @@ -324,7 +324,7 @@ by themselves.") Specify the :indent argument to enable automatic indentation when newlines occur in your template.") -(defmethod srecode-insert-method ((sti srecode-template-inserter-newline) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-newline) dictionary) "Insert the STI inserter." ;; To be safe, indent the previous line since the template will @@ -363,9 +363,9 @@ occur in your template.") ((stringp i) (princ i)))))) -(defmethod srecode-dump ((ins srecode-template-inserter-newline) indent) +(cl-defmethod srecode-dump ((ins srecode-template-inserter-newline) indent) "Dump the state of the SRecode template inserter INS." - (call-next-method) + (cl-call-next-method) (when (oref ins hard) (princ " : hard") )) @@ -388,7 +388,7 @@ When set to 'end it will insert a CR if we are not at 'eol'.") "Insert a newline before and after a template, and possibly do indenting. Specify the :blank argument to enable this inserter.") -(defmethod srecode-insert-method ((sti srecode-template-inserter-blank) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-blank) dictionary) "Make sure there is no text before or after point." (let ((i (srecode-dictionary-lookup-name dictionary "INDENT")) @@ -425,7 +425,7 @@ Specify the :blank argument to enable this inserter.") ) "Allow comments within template coding. This inserts nothing.") -(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-comment) +(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-comment)) escape-start escape-end) "Insert an example using inserter INS. Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." @@ -436,7 +436,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." (terpri) ) -(defmethod srecode-insert-method ((sti srecode-template-inserter-comment) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-comment) dictionary) "Don't insert anything for comment macros in STI." nil) @@ -453,7 +453,7 @@ If there is no entry, insert nothing.") (defvar srecode-inserter-variable-current-dictionary nil "The active dictionary when calling a variable filter.") -(defmethod srecode-insert-variable-secondname-handler +(cl-defmethod srecode-insert-variable-secondname-handler ((sti srecode-template-inserter-variable) dictionary value secondname) "For VALUE handle SECONDNAME behaviors for this variable inserter. Return the result as a string. @@ -471,7 +471,7 @@ If SECONDNAME is nil, return VALUE." (object-print sti) secondname))) value)) -(defmethod srecode-insert-method ((sti srecode-template-inserter-variable) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-variable) dictionary) "Insert the STI inserter." ;; Convert the name into a name/fcn pair @@ -541,7 +541,7 @@ If there is no entry, prompt the user for the value to use. The prompt text used is derived from the previous PROMPT command in the template file.") -(defmethod srecode-inserter-apply-state +(cl-defmethod srecode-inserter-apply-state ((ins srecode-template-inserter-ask) STATE) "For the template inserter INS, apply information from STATE. Loop over the prompts to see if we have a match." @@ -561,14 +561,14 @@ Loop over the prompts to see if we have a match." (setq prompts (cdr prompts))) )) -(defmethod srecode-insert-method ((sti srecode-template-inserter-ask) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-ask) dictionary) "Insert the STI inserter." (let ((val (srecode-dictionary-lookup-name dictionary (oref sti :object-name)))) (if val ;; Does some extra work. Oh well. - (call-next-method) + (cl-call-next-method) ;; How is our -ask value determined? (if srecode-insert-with-fields-in-progress @@ -585,9 +585,9 @@ Loop over the prompts to see if we have a match." ;; Now that this value is safely stowed in the dictionary, ;; we can do what regular inserters do. - (call-next-method)))) + (cl-call-next-method)))) -(defmethod srecode-insert-ask-default ((sti srecode-template-inserter-ask) +(cl-defmethod srecode-insert-ask-default ((sti srecode-template-inserter-ask) dictionary) "Derive the default value for an askable inserter STI. DICTIONARY is used to derive some values." @@ -612,7 +612,7 @@ DICTIONARY is used to derive some values." dictionary "Unknown default for prompt: %S" defaultfcn))))) -(defmethod srecode-insert-method-ask ((sti srecode-template-inserter-ask) +(cl-defmethod srecode-insert-method-ask ((sti srecode-template-inserter-ask) dictionary) "Do the \"asking\" for the template inserter STI. Use DICTIONARY to resolve values." @@ -646,7 +646,7 @@ Use DICTIONARY to resolve values." val) ) -(defmethod srecode-insert-method-field ((sti srecode-template-inserter-ask) +(cl-defmethod srecode-insert-method-field ((sti srecode-template-inserter-ask) dictionary) "Create an editable field for the template inserter STI. Use DICTIONARY to resolve values." @@ -661,9 +661,9 @@ Use DICTIONARY to resolve values." ;; across multiple locations. compound-value)) -(defmethod srecode-dump ((ins srecode-template-inserter-ask) indent) +(cl-defmethod srecode-dump ((ins srecode-template-inserter-ask) indent) "Dump the state of the SRecode template inserter INS." - (call-next-method) + (cl-call-next-method) (princ " : \"") (princ (oref ins prompt)) (princ "\"") @@ -681,7 +681,7 @@ Thus a specification of `10:left' will insert the value of A to 10 characters, with spaces added to the left. Use `right' for adding spaces to the right.") -(defmethod srecode-insert-variable-secondname-handler +(cl-defmethod srecode-insert-variable-secondname-handler ((sti srecode-template-inserter-width) dictionary value width) "For VALUE handle WIDTH behaviors for this variable inserter. Return the result as a string. @@ -714,7 +714,7 @@ By default, treat as a function name." (concat padchars value) (concat value padchars)))))) -(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-width) +(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-width)) escape-start escape-end) "Insert an example using inserter INS. Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." @@ -750,7 +750,7 @@ The cursor is placed at the ^ macro after insertion. Some inserter macros, such as `srecode-template-inserter-include-wrap' will place text at the ^ macro from the included macro.") -(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-point) +(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-point)) escape-start escape-end) "Insert an example using inserter INS. Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." @@ -761,7 +761,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." (terpri) ) -(defmethod srecode-insert-method ((sti srecode-template-inserter-point) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-point) dictionary) "Insert the STI inserter. Save point in the class allocated 'point' slot. @@ -787,11 +787,11 @@ generalized marker will do something else. See "Wrap a section of a template under the control of a macro." :abstract t) -(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-subtemplate) +(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-subtemplate)) escape-start escape-end) "Insert an example using inserter INS. Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." - (call-next-method) + (cl-call-next-method) (princ " Template Text to control") (terpri) (princ " ") @@ -801,7 +801,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." (terpri) ) -(defmethod srecode-insert-subtemplate ((sti srecode-template-inserter-subtemplate) +(cl-defmethod srecode-insert-subtemplate ((sti srecode-template-inserter-subtemplate) dict slot) "Insert a subtemplate for the inserter STI with dictionary DICT." ;; Make sure that only dictionaries are used. @@ -814,7 +814,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." ;; Output the code from the sub-template. (srecode-insert-method (slot-value sti slot) dict)) -(defmethod srecode-insert-method-helper ((sti srecode-template-inserter-subtemplate) +(cl-defmethod srecode-insert-method-helper ((sti srecode-template-inserter-subtemplate) dictionary slot) "Do the work for inserting the STI inserter. Loops over the embedded CODE which was saved here during compilation. @@ -837,7 +837,7 @@ The template to insert is stored in SLOT." (srecode-insert-subtemplate sti (car dicts) slot) (setq dicts (cdr dicts))))) -(defmethod srecode-insert-method ((sti srecode-template-inserter-subtemplate) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-subtemplate) dictionary) "Insert the STI inserter. Calls back to `srecode-insert-method-helper' for this class." @@ -858,7 +858,7 @@ The dictionary saved at the named dictionary entry will be applied to the text between the section start and the `srecode-template-inserter-section-end' macro.") -(defmethod srecode-parse-input ((ins srecode-template-inserter-section-start) +(cl-defmethod srecode-parse-input ((ins srecode-template-inserter-section-start) tag input STATE) "For the section inserter INS, parse INPUT. Shorten input until the END token is found. @@ -872,9 +872,9 @@ Return the remains of INPUT." :code (cdr out))) (car out))) -(defmethod srecode-dump ((ins srecode-template-inserter-section-start) indent) +(cl-defmethod srecode-dump ((ins srecode-template-inserter-section-start) indent) "Dump the state of the SRecode template inserter INS." - (call-next-method) + (cl-call-next-method) (princ "\n") (srecode-dump-code-list (oref (oref ins template) code) (concat indent " ")) @@ -889,12 +889,12 @@ Return the remains of INPUT." "All template segments between the section-start and section-end are treated specially.") -(defmethod srecode-insert-method ((sti srecode-template-inserter-section-end) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-section-end) dictionary) "Insert the STI inserter." ) -(defmethod srecode-match-end ((ins srecode-template-inserter-section-end) name) +(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))) @@ -912,7 +912,7 @@ are treated specially.") The included template will have additional dictionary entries from the subdictionary stored specified by this macro.") -(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-include) +(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-include)) escape-start escape-end) "Insert an example using inserter INS. Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." @@ -923,7 +923,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." (terpri) ) -(defmethod srecode-insert-include-lookup ((sti srecode-template-inserter-include) +(cl-defmethod srecode-insert-include-lookup ((sti srecode-template-inserter-include) dictionary) "For the template inserter STI, lookup the template to include. Finds the template with this macro function part and stores it in @@ -981,7 +981,7 @@ this template instance." "No template \"%s\" found for include macro `%s'" templatenamepart (oref sti :object-name))))) -(defmethod srecode-insert-method ((sti srecode-template-inserter-include) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-include) dictionary) "Insert the STI inserter. Finds the template with this macro function part, and inserts it @@ -1017,7 +1017,7 @@ stored specified by this macro. If the included macro includes a ^ macro, then the text between this macro and the end macro will be inserted at the ^ macro.") -(defmethod srecode-inserter-prin-example :STATIC ((ins srecode-template-inserter-include-wrap) +(cl-defmethod srecode-inserter-prin-example ((ins (subclass srecode-template-inserter-include-wrap)) escape-start escape-end) "Insert an example using inserter INS. Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." @@ -1035,7 +1035,7 @@ Arguments ESCAPE-START and ESCAPE-END are the current escape sequences in use." (terpri) ) -(defmethod srecode-insert-method ((sti srecode-template-inserter-include-wrap) +(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-include-wrap) dictionary) "Insert the template STI. This will first insert the include part via inheritance, then @@ -1067,7 +1067,7 @@ template where a ^ inserter occurs." inserter1 dict 'template)))))))) ;; Do a regular insertion for an include, but with our override in ;; place. - (call-next-method))) + (cl-call-next-method))) (provide 'srecode/insert) diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el index cc0c4ae4427..71ed835e4ff 100644 --- a/lisp/cedet/srecode/map.el +++ b/lisp/cedet/srecode/map.el @@ -67,11 +67,11 @@ Each app keys to an alist of files and modes (as above.)") ) "A map of srecode templates.") -(defmethod srecode-map-entry-for-file ((map srecode-map) file) +(cl-defmethod srecode-map-entry-for-file ((map srecode-map) file) "Return the entry in MAP for FILE." (assoc file (oref map files))) -(defmethod srecode-map-entries-for-mode ((map srecode-map) mode) +(cl-defmethod srecode-map-entries-for-mode ((map srecode-map) mode) "Return the entries in MAP for major MODE." (let ((ans nil)) (dolist (f (oref map files)) @@ -79,12 +79,12 @@ Each app keys to an alist of files and modes (as above.)") (setq ans (cons f ans)))) ans)) -(defmethod srecode-map-entry-for-app ((map srecode-map) app) +(cl-defmethod srecode-map-entry-for-app ((map srecode-map) app) "Return the entry in MAP for APP." (assoc app (oref map apps)) ) -(defmethod srecode-map-entries-for-app-and-mode ((map srecode-map) app mode) +(cl-defmethod srecode-map-entries-for-app-and-mode ((map srecode-map) app mode) "Return the entries in MAP for major MODE." (let ((ans nil) (appentry (srecode-map-entry-for-app map app))) @@ -93,7 +93,7 @@ Each app keys to an alist of files and modes (as above.)") (setq ans (cons f ans)))) ans)) -(defmethod srecode-map-entry-for-file-anywhere ((map srecode-map) file) +(cl-defmethod srecode-map-entry-for-file-anywhere ((map srecode-map) file) "Search in all entry points in MAP for FILE. Return a list ( APP . FILE-ASSOC ) where APP is nil in the global map." @@ -112,13 +112,13 @@ in the global map." ;; Other? )) -(defmethod srecode-map-delete-file-entry ((map srecode-map) file) +(cl-defmethod srecode-map-delete-file-entry ((map srecode-map) file) "Update MAP to exclude FILE from the file list." (let ((entry (srecode-map-entry-for-file map file))) (when entry (object-remove-from-list map 'files entry)))) -(defmethod srecode-map-update-file-entry ((map srecode-map) file mode) +(cl-defmethod srecode-map-update-file-entry ((map srecode-map) file mode) "Update a MAP entry for FILE to be used with MODE. Return non-nil if the MAP was changed." (let ((entry (srecode-map-entry-for-file map file)) @@ -136,14 +136,14 @@ Return non-nil if the MAP was changed." )) dirty)) -(defmethod srecode-map-delete-file-entry-from-app ((map srecode-map) file app) +(cl-defmethod srecode-map-delete-file-entry-from-app ((map srecode-map) file app) "Delete from MAP the FILE entry within the APP." (let* ((appe (srecode-map-entry-for-app map app)) (fentry (assoc file (cdr appe)))) (setcdr appe (delete fentry (cdr appe)))) ) -(defmethod srecode-map-update-app-file-entry ((map srecode-map) file mode app) +(cl-defmethod srecode-map-update-app-file-entry ((map srecode-map) file mode app) "Update the MAP entry for FILE to be used with MODE within APP. Return non-nil if the map was changed." (let* ((appentry (srecode-map-entry-for-app map app)) diff --git a/lisp/cedet/srecode/semantic.el b/lisp/cedet/srecode/semantic.el index 2313fa73b73..0ea2ab4a5ff 100644 --- a/lisp/cedet/srecode/semantic.el +++ b/lisp/cedet/srecode/semantic.el @@ -55,7 +55,7 @@ "Wrap up a collection of semantic tag information. This class will be used to derive dictionary values.") -(defmethod srecode-compound-toString((cp srecode-semantic-tag) +(cl-defmethod srecode-compound-toString((cp srecode-semantic-tag) function dictionary) "Convert the compound dictionary value CP to a string. diff --git a/lisp/cedet/srecode/table.el b/lisp/cedet/srecode/table.el index b4f20a9f35f..a2baa7b231f 100644 --- a/lisp/cedet/srecode/table.el +++ b/lisp/cedet/srecode/table.el @@ -26,6 +26,7 @@ ;; (require 'eieio) +(require 'cl-generic) (require 'eieio-base) (require 'mode-local) (require 'srecode) @@ -172,7 +173,7 @@ calculate all inherited templates from parent modes." new)))) -(defmethod srecode-mode-table-find ((mt srecode-mode-table) file) +(cl-defmethod srecode-mode-table-find ((mt srecode-mode-table) file) "Look in the mode table MT for a template table from FILE. Return nil if there was none." (object-assoc file 'file (oref mt modetables))) @@ -235,7 +236,7 @@ Use PREDICATE is the same as for the `sort' function." (srecode-dump tmp)) ))) -(defmethod srecode-dump ((tab srecode-mode-table)) +(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)) @@ -248,7 +249,7 @@ Use PREDICATE is the same as for the `sort' function." (setq subtab (cdr subtab))) )) -(defmethod srecode-dump ((tab srecode-template-table)) +(cl-defmethod srecode-dump ((tab srecode-template-table)) "Dump the contents of the SRecode template table TAB." (princ "Template Table for ") (princ (eieio-object-name-string tab)) |