mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-11 09:20:51 +00:00
CEDET: Remove left-over uses of obsolete <class>-child-p predicates
Those predicates were still sometimes used in a few places, notably via `:type ... <class>-child` which was never technically correct. * lisp/cedet/ede/config.el (ede-extra-config, ede-project-with-config): * lisp/cedet/ede/base.el (ede-project-placeholder): Avoid pseudo-type `<class>-child`. * lisp/cedet/semantic/complete.el (semantic-displayer-focus-abstract): Move before use of `cl-typep` on it. (semantic-complete-current-match): * lisp/cedet/ede/speedbar.el (ede-speedbar-menu): Use `cl-typep` instead of `<class>-child-p`. * lisp/cedet/semantic/db.el (semanticdb-get-buffer): Use `cl-defgeneric` for the main/default definition. (semantic-tag-parent-buffer): Add method. * lisp/cedet/semantic/tag-file.el (semantic-tag-parent-buffer): New generic function extracted from `semantic-go-to-tag`. This allows us to keep the semanticdb-table part in semantic/db and thus break a cyclic dependency. (semantic-go-to-tag): Use it. Demote to a plain `defun` since it's not overloaded anywhere. * lisp/cedet/semantic/util.el (semanticdb-abstract-table-child-p): Remove unused declaration. * lisp/cedet/srecode/compile.el (srecode-template-inserter-newline-child-p): Remove unused declaration. (srecord-compile-inserter-newline-p): New generic function, so we can move the `srecode-template-inserter-newline` case to `srecode/insert.el`, to avoid a cyclic dependency. * lisp/cedet/srecode/insert.el (srecord-compile-inserter-newline-p): New method.
This commit is contained in:
parent
2be7ed257b
commit
344b48f490
@ -141,7 +141,7 @@ For some project types, this will be the file that stores the project configurat
|
|||||||
In other projects types, this file is merely a unique identifier to this type of project.")
|
In other projects types, this file is merely a unique identifier to this type of project.")
|
||||||
(rootproject ; :initarg - no initarg, don't save this slot!
|
(rootproject ; :initarg - no initarg, don't save this slot!
|
||||||
:initform nil
|
:initform nil
|
||||||
:type (or null ede-project-placeholder-child)
|
:type (or null ede-project-placeholder)
|
||||||
:documentation "Pointer to our root project.")
|
:documentation "Pointer to our root project.")
|
||||||
)
|
)
|
||||||
"Placeholder object for projects not loaded into memory.
|
"Placeholder object for projects not loaded into memory.
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
(defclass ede-extra-config (eieio-persistent)
|
(defclass ede-extra-config (eieio-persistent)
|
||||||
((extension :initform ".ede")
|
((extension :initform ".ede")
|
||||||
(file-header-line :initform ";; EDE Project Configuration")
|
(file-header-line :initform ";; EDE Project Configuration")
|
||||||
(project :type ede-project-with-config-child
|
(project :type ede-project-with-config
|
||||||
:documentation
|
:documentation
|
||||||
"The project this config is bound to.")
|
"The project this config is bound to.")
|
||||||
(ignored-file :initform nil
|
(ignored-file :initform nil
|
||||||
@ -102,7 +102,7 @@ initialize the :file slot of the persistent baseclass.")
|
|||||||
:documentation
|
:documentation
|
||||||
"The class of the configuration used by this project.")
|
"The class of the configuration used by this project.")
|
||||||
(config :initform nil
|
(config :initform nil
|
||||||
:type (or null ede-extra-config-child)
|
:type (or null ede-extra-config)
|
||||||
:documentation
|
:documentation
|
||||||
"The configuration object for this project.")
|
"The configuration object for this project.")
|
||||||
)
|
)
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
(defvar ede-speedbar-menu
|
(defvar ede-speedbar-menu
|
||||||
'([ "Compile" ede-speedbar-compile-line t]
|
'([ "Compile" ede-speedbar-compile-line t]
|
||||||
[ "Compile Project" ede-speedbar-compile-project
|
[ "Compile Project" ede-speedbar-compile-project
|
||||||
(ede-project-child-p (speedbar-line-token)) ]
|
(cl-typep (speedbar-line-token) 'ede-project) ]
|
||||||
"---"
|
"---"
|
||||||
[ "Edit File/Tag" speedbar-edit-line
|
[ "Edit File/Tag" speedbar-edit-line
|
||||||
(not (eieio-object-p (speedbar-line-token)))]
|
(not (eieio-object-p (speedbar-line-token)))]
|
||||||
@ -79,7 +79,7 @@
|
|||||||
(eieio-object-p (speedbar-line-token)) ]
|
(eieio-object-p (speedbar-line-token)) ]
|
||||||
[ "Edit Project File" ede-speedbar-edit-projectfile t]
|
[ "Edit Project File" ede-speedbar-edit-projectfile t]
|
||||||
[ "Make Distribution" ede-speedbar-make-distribution
|
[ "Make Distribution" ede-speedbar-make-distribution
|
||||||
(ede-project-child-p (speedbar-line-token)) ]
|
(cl-typep (speedbar-line-token) 'ede-project) ]
|
||||||
)
|
)
|
||||||
"Menu part in easymenu format used in speedbar while browsing objects.")
|
"Menu part in easymenu format used in speedbar while browsing objects.")
|
||||||
|
|
||||||
|
@ -311,11 +311,27 @@ HISTORY is a symbol representing a variable to story the history in."
|
|||||||
(defvar semantic-complete-current-matched-tag nil
|
(defvar semantic-complete-current-matched-tag nil
|
||||||
"Variable used to pass the tags being matched to the prompt.")
|
"Variable used to pass the tags being matched to the prompt.")
|
||||||
|
|
||||||
;; semantic-displayer-focus-abstract-child-p is part of the
|
|
||||||
;; semantic-displayer-focus-abstract class, defined later in this
|
|
||||||
;; file.
|
;; Abstract baseclass for any displayer which supports focus
|
||||||
(declare-function semantic-displayer-focus-abstract-child-p "semantic/complete"
|
(defclass semantic-displayer-focus-abstract (semantic-displayer-abstract)
|
||||||
t t)
|
((focus :type number
|
||||||
|
:protection :protected
|
||||||
|
:documentation "A tag index from `table' which has focus.
|
||||||
|
Multiple calls to the display function can choose to focus on a
|
||||||
|
given tag, by highlighting its location.")
|
||||||
|
(find-file-focus
|
||||||
|
:allocation :class
|
||||||
|
:initform nil
|
||||||
|
:documentation
|
||||||
|
"Non-nil if focusing requires a tag's buffer be in memory.")
|
||||||
|
)
|
||||||
|
"Abstract displayer supporting `focus'.
|
||||||
|
A displayer which has the ability to focus in on one tag.
|
||||||
|
Focusing is a way of differentiating among multiple tags
|
||||||
|
which have the same name."
|
||||||
|
:abstract t)
|
||||||
|
|
||||||
|
|
||||||
(defun semantic-complete-current-match ()
|
(defun semantic-complete-current-match ()
|
||||||
"Calculate a match from the current completion environment.
|
"Calculate a match from the current completion environment.
|
||||||
@ -346,7 +362,7 @@ Return value can be:
|
|||||||
((setq matchlist (semantic-collector-current-exact-match collector))
|
((setq matchlist (semantic-collector-current-exact-match collector))
|
||||||
(if (= (semanticdb-find-result-length matchlist) 1)
|
(if (= (semanticdb-find-result-length matchlist) 1)
|
||||||
(setq answer (semanticdb-find-result-nth-in-buffer matchlist 0))
|
(setq answer (semanticdb-find-result-nth-in-buffer matchlist 0))
|
||||||
(if (semantic-displayer-focus-abstract-child-p displayer)
|
(if (cl-typep displayer 'semantic-displayer-focus-abstract)
|
||||||
;; For focusing displayers, we can claim this is
|
;; For focusing displayers, we can claim this is
|
||||||
;; not unique. Multiple focuses can choose the correct
|
;; not unique. Multiple focuses can choose the correct
|
||||||
;; one.
|
;; one.
|
||||||
@ -1407,24 +1423,7 @@ to click on the items to aid in completion.")
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
;;; Abstract baseclass for any displayer which supports focus
|
;;; Methods for any displayer which supports focus
|
||||||
(defclass semantic-displayer-focus-abstract (semantic-displayer-abstract)
|
|
||||||
((focus :type number
|
|
||||||
:protection :protected
|
|
||||||
:documentation "A tag index from `table' which has focus.
|
|
||||||
Multiple calls to the display function can choose to focus on a
|
|
||||||
given tag, by highlighting its location.")
|
|
||||||
(find-file-focus
|
|
||||||
:allocation :class
|
|
||||||
:initform nil
|
|
||||||
:documentation
|
|
||||||
"Non-nil if focusing requires a tag's buffer be in memory.")
|
|
||||||
)
|
|
||||||
"Abstract displayer supporting `focus'.
|
|
||||||
A displayer which has the ability to focus in on one tag.
|
|
||||||
Focusing is a way of differentiating among multiple tags
|
|
||||||
which have the same name."
|
|
||||||
:abstract t)
|
|
||||||
|
|
||||||
(define-obsolete-function-alias 'semantic-displayor-next-action
|
(define-obsolete-function-alias 'semantic-displayor-next-action
|
||||||
#'semantic-displayer-next-action "27.1")
|
#'semantic-displayer-next-action "27.1")
|
||||||
|
@ -362,7 +362,7 @@ a master list."
|
|||||||
;; don't include ourselves in this crazy list.
|
;; don't include ourselves in this crazy list.
|
||||||
(when (and i (not (eq i table))
|
(when (and i (not (eq i table))
|
||||||
;; @todo - This eieio fcn can be slow! Do I need it?
|
;; @todo - This eieio fcn can be slow! Do I need it?
|
||||||
;; (semanticdb-table-child-p i)
|
;; (cl-typep i 'semanticdb-table)
|
||||||
)
|
)
|
||||||
(setq incstream
|
(setq incstream
|
||||||
(semanticdb-typecache-merge-streams
|
(semanticdb-typecache-merge-streams
|
||||||
|
@ -115,11 +115,13 @@ for a new table not associated with a buffer."
|
|||||||
"Return a nil, meaning abstract table OBJ is not in a buffer."
|
"Return a nil, meaning abstract table OBJ is not in a buffer."
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
(cl-defmethod semanticdb-get-buffer ((_obj semanticdb-abstract-table))
|
(cl-defgeneric semanticdb-get-buffer (_obj)
|
||||||
"Return a buffer associated with OBJ.
|
"Return a buffer associated with semanticdb table OBJ.
|
||||||
If the buffer is not in memory, load it with `find-file-noselect'."
|
If the buffer is not in memory, load it with `find-file-noselect'."
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
|
;; FIXME: Should we merge `semanticdb-get-buffer' and
|
||||||
|
;; `semantic-tag-parent-buffer'?
|
||||||
;; This generic method allows for sloppier coding. Many
|
;; This generic method allows for sloppier coding. Many
|
||||||
;; functions treat "table" as something that could be a buffer,
|
;; functions treat "table" as something that could be a buffer,
|
||||||
;; file name, or other. This makes use of table more robust.
|
;; file name, or other. This makes use of table more robust.
|
||||||
@ -271,6 +273,9 @@ For C/C++, the C preprocessor macros can be saved here.")
|
|||||||
)
|
)
|
||||||
"A single table of tags derived from file.")
|
"A single table of tags derived from file.")
|
||||||
|
|
||||||
|
(cl-defmethod semantic-tag-parent-buffer ((parent semanticdb-table))
|
||||||
|
(semanticdb-get-buffer parent)) ;FIXME: η-redex!
|
||||||
|
|
||||||
(cl-defmethod semanticdb-in-buffer-p ((obj semanticdb-table))
|
(cl-defmethod semanticdb-in-buffer-p ((obj semanticdb-table))
|
||||||
"Return a buffer associated with OBJ.
|
"Return a buffer associated with OBJ.
|
||||||
If the buffer is in memory, return that buffer."
|
If the buffer is in memory, return that buffer."
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
(require 'semantic/tag)
|
(require 'semantic/tag)
|
||||||
|
|
||||||
(defvar ede-minor-mode)
|
(defvar ede-minor-mode)
|
||||||
(declare-function semanticdb-table-child-p "semantic/db" t t)
|
|
||||||
(declare-function semanticdb-get-buffer "semantic/db")
|
|
||||||
(declare-function semantic-dependency-find-file-on-path "semantic/dep")
|
(declare-function semantic-dependency-find-file-on-path "semantic/dep")
|
||||||
(declare-function ede-toplevel "ede/base")
|
(declare-function ede-toplevel "ede/base")
|
||||||
|
|
||||||
@ -37,68 +35,66 @@
|
|||||||
|
|
||||||
;;; Location a TAG came from.
|
;;; Location a TAG came from.
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
(cl-defgeneric semantic-tag-parent-buffer (parent)
|
||||||
|
"Return the buffer in which a tag can be found, knowing its PARENT."
|
||||||
|
(cond ((and (semantic-tag-p parent) (semantic-tag-in-buffer-p parent))
|
||||||
|
;; We have a parent with a buffer, then go there.
|
||||||
|
(semantic-tag-buffer parent))
|
||||||
|
((and (semantic-tag-p parent) (semantic-tag-file-name parent))
|
||||||
|
;; The parent only has a file-name, then
|
||||||
|
;; find that file, and switch to that buffer.
|
||||||
|
(find-file-noselect (semantic-tag-file-name parent)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-overloadable-function semantic-go-to-tag (tag &optional parent)
|
(defun semantic-go-to-tag (tag &optional parent)
|
||||||
"Go to the location of TAG.
|
"Go to the location of TAG.
|
||||||
TAG may be a stripped element, in which case PARENT specifies a
|
TAG may be a stripped element, in which case PARENT specifies a
|
||||||
parent tag that has position information.
|
parent tag that has position information.
|
||||||
PARENT can also be a `semanticdb-table' object."
|
PARENT can also be a `semanticdb-table' object."
|
||||||
(:override
|
(save-match-data
|
||||||
(save-match-data
|
(set-buffer
|
||||||
(cond ((semantic-tag-in-buffer-p tag)
|
(cond ((semantic-tag-in-buffer-p tag)
|
||||||
;; We have a linked tag, go to that buffer.
|
;; We have a linked tag, go to that buffer.
|
||||||
(set-buffer (semantic-tag-buffer tag)))
|
(semantic-tag-buffer tag))
|
||||||
((semantic-tag-file-name tag)
|
((semantic-tag-file-name tag)
|
||||||
;; If it didn't have a buffer, but does have a file
|
;; If it didn't have a buffer, but does have a file
|
||||||
;; name, then we need to get to that file so the tag
|
;; name, then we need to get to that file so the tag
|
||||||
;; location is made accurate.
|
;; location is made accurate.
|
||||||
(set-buffer (find-file-noselect (semantic-tag-file-name tag))))
|
(find-file-noselect (semantic-tag-file-name tag)))
|
||||||
((and parent (semantic-tag-p parent) (semantic-tag-in-buffer-p parent))
|
((and parent (semantic-tag-parent-buffer parent)))
|
||||||
;; The tag had nothing useful, but we have a parent with
|
;; Well, just assume things are in the current buffer.
|
||||||
;; a buffer, then go there.
|
(t (current-buffer)))))
|
||||||
(set-buffer (semantic-tag-buffer parent)))
|
;; We should be in the correct buffer now, try and figure out
|
||||||
((and parent (semantic-tag-p parent) (semantic-tag-file-name parent))
|
;; where the tag is.
|
||||||
;; Tag had nothing, and the parent only has a file-name, then
|
(cond ((semantic-tag-with-position-p tag)
|
||||||
;; find that file, and switch to that buffer.
|
;; If it's a number, go there
|
||||||
(set-buffer (find-file-noselect (semantic-tag-file-name parent))))
|
(goto-char (semantic-tag-start tag)))
|
||||||
((and parent (featurep 'semantic/db)
|
((semantic-tag-with-position-p parent)
|
||||||
(semanticdb-table-child-p parent))
|
;; Otherwise, it's a trimmed vector, such as a parameter,
|
||||||
(set-buffer (semanticdb-get-buffer parent)))
|
;; or a structure part. If there is a parent, we can use it
|
||||||
(t
|
;; as a bounds for searching.
|
||||||
;; Well, just assume things are in the current buffer.
|
(goto-char (semantic-tag-start parent))
|
||||||
nil
|
;; Here we make an assumption that the text returned by
|
||||||
)))
|
;; the parser and concocted by us actually exists
|
||||||
;; We should be in the correct buffer now, try and figure out
|
;; in the buffer.
|
||||||
;; where the tag is.
|
(re-search-forward (semantic-tag-name tag)
|
||||||
(cond ((semantic-tag-with-position-p tag)
|
(semantic-tag-end parent)
|
||||||
;; If it's a number, go there
|
t))
|
||||||
(goto-char (semantic-tag-start tag)))
|
((semantic-tag-get-attribute tag :line)
|
||||||
((semantic-tag-with-position-p parent)
|
;; The tag has a line number in it. Go there.
|
||||||
;; Otherwise, it's a trimmed vector, such as a parameter,
|
(goto-char (point-min))
|
||||||
;; or a structure part. If there is a parent, we can use it
|
(forward-line (1- (semantic-tag-get-attribute tag :line))))
|
||||||
;; as a bounds for searching.
|
((and (semantic-tag-p parent) (semantic-tag-get-attribute parent :line))
|
||||||
(goto-char (semantic-tag-start parent))
|
;; The tag has a line number in it. Go there.
|
||||||
;; Here we make an assumption that the text returned by
|
(goto-char (point-min))
|
||||||
;; the parser and concocted by us actually exists
|
(forward-line (1- (semantic-tag-get-attribute parent :line)))
|
||||||
;; in the buffer.
|
(re-search-forward (semantic-tag-name tag) nil t))
|
||||||
(re-search-forward (semantic-tag-name tag)
|
(t
|
||||||
(semantic-tag-end parent)
|
;; Take a guess that the tag has a unique name, and just
|
||||||
t))
|
;; search for it from the beginning of the buffer.
|
||||||
((semantic-tag-get-attribute tag :line)
|
(goto-char (point-min))
|
||||||
;; The tag has a line number in it. Go there.
|
(re-search-forward (semantic-tag-name tag) nil t)))
|
||||||
(goto-char (point-min))
|
|
||||||
(forward-line (1- (semantic-tag-get-attribute tag :line))))
|
|
||||||
((and (semantic-tag-p parent) (semantic-tag-get-attribute parent :line))
|
|
||||||
;; The tag has a line number in it. Go there.
|
|
||||||
(goto-char (point-min))
|
|
||||||
(forward-line (1- (semantic-tag-get-attribute parent :line)))
|
|
||||||
(re-search-forward (semantic-tag-name tag) nil t))
|
|
||||||
(t
|
|
||||||
;; Take a guess that the tag has a unique name, and just
|
|
||||||
;; search for it from the beginning of the buffer.
|
|
||||||
(goto-char (point-min))
|
|
||||||
(re-search-forward (semantic-tag-name tag) nil t)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
;;; Dependencies
|
;;; Dependencies
|
||||||
|
@ -77,7 +77,6 @@ If FILE is not loaded, and semanticdb is not available, find the file
|
|||||||
(with-current-buffer (find-file-noselect file)
|
(with-current-buffer (find-file-noselect file)
|
||||||
(semantic-fetch-tags))))))
|
(semantic-fetch-tags))))))
|
||||||
|
|
||||||
(declare-function semanticdb-abstract-table-child-p "semantic/db" (obj) t)
|
|
||||||
(declare-function semanticdb-refresh-table "semantic/db")
|
(declare-function semanticdb-refresh-table "semantic/db")
|
||||||
(declare-function semanticdb-get-tags "semantic/db" (arg &rest args) t)
|
(declare-function semanticdb-get-tags "semantic/db" (arg &rest args) t)
|
||||||
(declare-function semanticdb-find-results-p "semantic/db-find" (resultp))
|
(declare-function semanticdb-find-results-p "semantic/db-find" (resultp))
|
||||||
@ -115,8 +114,6 @@ buffer, or a filename. If SOMETHING is nil return nil."
|
|||||||
(require 'semantic/db-mode)
|
(require 'semantic/db-mode)
|
||||||
(semanticdb-minor-mode-p)
|
(semanticdb-minor-mode-p)
|
||||||
(progn
|
(progn
|
||||||
(declare-function semanticdb-abstract-table--eieio-childp
|
|
||||||
"semantic/db")
|
|
||||||
(cl-typep something 'semanticdb-abstract-table)))
|
(cl-typep something 'semanticdb-abstract-table)))
|
||||||
(semanticdb-refresh-table something)
|
(semanticdb-refresh-table something)
|
||||||
(semanticdb-get-tags something))
|
(semanticdb-get-tags something))
|
||||||
|
@ -38,9 +38,6 @@
|
|||||||
(require 'srecode/table)
|
(require 'srecode/table)
|
||||||
(require 'srecode/dictionary)
|
(require 'srecode/dictionary)
|
||||||
|
|
||||||
(declare-function srecode-template-inserter-newline-child-p "srecode/insert"
|
|
||||||
t t)
|
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
;;; Template Class
|
;;; Template Class
|
||||||
@ -378,8 +375,11 @@ It is hard if the previous inserter is a newline object."
|
|||||||
(while (and comp (stringp (car comp)))
|
(while (and comp (stringp (car comp)))
|
||||||
(setq comp (cdr comp)))
|
(setq comp (cdr comp)))
|
||||||
(or (not comp)
|
(or (not comp)
|
||||||
(progn (require 'srecode/insert)
|
(srecord-compile-inserter-newline-p (car comp))))
|
||||||
(srecode-template-inserter-newline-child-p (car comp)))))
|
|
||||||
|
(cl-defgeneric srecord-compile-inserter-newline-p (_obj)
|
||||||
|
"Non-nil if OBJ is a newline inserter object."
|
||||||
|
nil)
|
||||||
|
|
||||||
(defun srecode-compile-split-code (tag str STATE
|
(defun srecode-compile-split-code (tag str STATE
|
||||||
&optional end-name)
|
&optional end-name)
|
||||||
|
@ -319,6 +319,10 @@ by themselves.")
|
|||||||
Specify the :indent argument to enable automatic indentation when newlines
|
Specify the :indent argument to enable automatic indentation when newlines
|
||||||
occur in your template.")
|
occur in your template.")
|
||||||
|
|
||||||
|
(cl-defmethod srecord-compile-inserter-newline-p
|
||||||
|
((_ srecode-template-inserter-newline))
|
||||||
|
t)
|
||||||
|
|
||||||
(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-newline)
|
(cl-defmethod srecode-insert-method ((sti srecode-template-inserter-newline)
|
||||||
dictionary)
|
dictionary)
|
||||||
"Insert the STI inserter."
|
"Insert the STI inserter."
|
||||||
|
Loading…
Reference in New Issue
Block a user