Function: semanticdb-find-result-nth

semanticdb-find-result-nth is a byte-compiled function defined in db-find.el.gz.

Signature

(semanticdb-find-result-nth RESULT N)

Documentation

In RESULT, return the Nth search result.

This is a 0 based search result, with the first match being element 0.

The returned value is a cons cell: (TAG . TABLE) where TAG is the tag at the Nth position. TABLE is the semanticdb table where the TAG was found. Sometimes TABLE can be nil.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/db-find.el.gz
;;;###autoload
(defun semanticdb-find-result-nth (result n)
  "In RESULT, return the Nth search result.
This is a 0 based search result, with the first match being element 0.

The returned value is a cons cell: (TAG . TABLE) where TAG
is the tag at the Nth position.  TABLE is the semanticdb table where
the TAG was found.  Sometimes TABLE can be nil."
  (let ((ans nil)
	(anstable nil))
    ;; Loop over each single table hit.
    (while (and (not ans) result)
      ;; For each table result, get local length, and modify
      ;; N to be that much less.
      (let ((ll (length (cdr (car result))))) ;; local length
	(if (> ll n)
	    ;; We have a local match.
	    (setq ans (nth n (cdr (car result)))
		  anstable (car (car result)))
	  ;; More to go.  Decrement N.
	  (setq n (- n ll))))
      ;; Keep moving.
      (setq result (cdr result)))
    (cons ans anstable)))