Function: ebrowse-view/find-member-declaration/definition
ebrowse-view/find-member-declaration/definition is a byte-compiled
function defined in ebrowse.el.gz.
Signature
(ebrowse-view/find-member-declaration/definition PREFIX VIEW &optional DEFINITION INFO HEADER TAGS-FILE)
Documentation
Find or view a member declaration or definition.
With PREFIX 4. find file in another window, with prefix 5 find file in another frame. DEFINITION non-nil means find the definition, otherwise find the declaration. INFO is a list (TREE ACCESSOR MEMBER) describing the member to search. TAGS-FILE is the file name of the BROWSE file.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/ebrowse.el.gz
(cl-defun ebrowse-view/find-member-declaration/definition
(prefix view &optional definition info header tags-file)
"Find or view a member declaration or definition.
With PREFIX 4. find file in another window, with prefix 5
find file in another frame.
DEFINITION non-nil means find the definition, otherwise find the
declaration.
INFO is a list (TREE ACCESSOR MEMBER) describing the member to
search.
TAGS-FILE is the file name of the BROWSE file."
(unless header
(setq header ebrowse--header))
(unless tags-file
(setq tags-file ebrowse--tags-file-name))
(let (tree member accessor file on-class
(where (if (= prefix 4) 'other-window
(if (= prefix 5) 'other-frame 'this-window))))
;; If not given as parameters, get the necessary information
;; out of the member buffer.
(if info
(setq tree (cl-first info)
accessor (cl-second info)
member (cl-third info))
(cl-multiple-value-setq (tree member on-class)
(cl-values-list (ebrowse-member-info-from-point)))
(setq accessor ebrowse--accessor))
;; View/find class if on a line containing a class name.
(when on-class
(cl-return-from ebrowse-view/find-member-declaration/definition
(ebrowse-view/find-file-and-search-pattern
(ebrowse-ts-class tree)
(list ebrowse--header (ebrowse-ts-class tree) nil)
(ebrowse-cs-file (ebrowse-ts-class tree))
tags-file view where)))
;; For some member lists, it doesn't make sense to search for
;; a definition. If this is requested, silently search for the
;; declaration.
(when (and definition
(eq accessor 'ebrowse-ts-member-variables))
(setq definition nil))
;; Construct a suitable `browse' struct for definitions.
(when definition
(setf member (make-ebrowse-ms
:name (ebrowse-ms-name member)
:file (ebrowse-ms-definition-file member)
:pattern (ebrowse-ms-definition-pattern
member)
:flags (ebrowse-ms-flags member)
:point (ebrowse-ms-definition-point
member))))
;; When no file information in member, use that of the class
(setf file (or (ebrowse-ms-file member)
(if definition
(ebrowse-cs-source-file (ebrowse-ts-class tree))
(ebrowse-cs-file (ebrowse-ts-class tree)))))
;; When we have no regular expressions in the database the only
;; indication that the parser hasn't seen a definition/declaration
;; is that the search start point will be zero.
(if (or (null file) (zerop (ebrowse-ms-point member)))
(if (y-or-n-p (concat "No information about "
(if definition "definition" "declaration")
". Search for "
(if definition "declaration" "definition")
" of `"
(ebrowse-ms-name member)
"'? "))
(progn
(message nil)
;; Recurse with new info.
(ebrowse-view/find-member-declaration/definition
prefix view (not definition) info header tags-file))
(error "Search canceled"))
;; Find that thing.
(ebrowse-view/find-file-and-search-pattern
(make-ebrowse-bs :name (ebrowse-ms-name member)
:pattern (ebrowse-ms-pattern member)
:file (ebrowse-ms-file member)
:flags (ebrowse-ms-flags member)
:point (ebrowse-ms-point member))
(list header member accessor)
file
tags-file
view
where))))