Function: semanticdb-strip-find-results

semanticdb-strip-find-results is a byte-compiled function defined in db-find.el.gz.

Signature

(semanticdb-strip-find-results RESULTS &optional FIND-FILE-MATCH)

Documentation

Strip a semanticdb search RESULTS to exclude objects.

This makes it appear more like the results of a semantic-find- call. Optional FIND-FILE-MATCH loads all files associated with RESULTS into buffers. This has the side effect of enabling semantic-tag-buffer to return a value. If FIND-FILE-MATCH is name, then only the filename is stored in each tag instead of loading each file into a buffer. If the input RESULTS are not going to be used again, and if FIND-FILE-MATCH is nil, you can use semanticdb-fast-strip-find-results instead.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/db-find.el.gz
;;; API Functions
;;
;; Once you have a search result, use these routines to operate
;; on the search results at a higher level

;;;###autoload
(defun semanticdb-strip-find-results (results &optional find-file-match)
  "Strip a semanticdb search RESULTS to exclude objects.
This makes it appear more like the results of a `semantic-find-' call.
Optional FIND-FILE-MATCH loads all files associated with RESULTS
into buffers.  This has the side effect of enabling `semantic-tag-buffer' to
return a value.
If FIND-FILE-MATCH is `name', then only the filename is stored
in each tag instead of loading each file into a buffer.
If the input RESULTS are not going to be used again, and if
FIND-FILE-MATCH is nil, you can use `semanticdb-fast-strip-find-results'
instead."
  (if find-file-match
      ;; Load all files associated with RESULTS.
      (let ((tmp results)
	    (output nil))
	(while tmp
	  (let ((tab (car (car tmp)))
		(tags (cdr (car tmp))))
	    (dolist (T tags)
	      ;; Normalization gives specialty database tables a chance
	      ;; to convert into a more stable tag format.
	      (let* ((norm (semanticdb-normalize-one-tag tab T))
		     (ntab (car norm))
		     (ntag (cdr norm))
		     (nametable ntab))

		;; If it didn't normalize, use what we had.
		(if (not norm)
		    (setq nametable tab)
		  (setq output (append output (list ntag))))

		;; Find-file-match allows a tool to make sure the tag is
		;; 'live', somewhere in a buffer.
		(cond ((eq find-file-match 'name)
		       (or (semantic--tag-get-property ntag :filename)
			   (let ((f (semanticdb-full-filename nametable)))
			     (semantic--tag-put-property ntag :filename f))))
		      ((and find-file-match ntab)
		       (semanticdb-get-buffer ntab))
		      )
		))
	    )
	  (setq tmp (cdr tmp)))
	output)
    ;; @todo - I could use nconc, but I don't know what the caller may do with
    ;;         RESULTS after this is called.  Right now semantic-complete will
    ;;         recycling the input after calling this routine.
    (apply #'append (mapcar #'cdr results))))