Function: etags-snarf-tag

etags-snarf-tag is a byte-compiled function defined in etags.el.gz.

Signature

(etags-snarf-tag &optional USE-EXPLICIT)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/etags.el.gz
(defun etags-snarf-tag (&optional use-explicit) ; Doc string?
  (let (tag-text line startpos explicit-start)
    (if (save-excursion
	  (forward-line -1)
	  (looking-at "\f\n"))
	;; The match was for a source file name, not any tag within a file.
	;; Give text of t, meaning to go exactly to the location we specify,
	;; the beginning of the file.
	(setq tag-text t
	      line nil
	      startpos (point-min))

      ;; Find the end of the tag and record the whole tag text.
      (search-forward "\177")
      (setq tag-text (buffer-substring (1- (point)) (point-at-bol)))
      ;; If use-explicit is non-nil and explicit tag is present, use it as part of
      ;; return value. Else just skip it.
      (setq explicit-start (point))
      (when (and (search-forward "\001" (point-at-bol 2) t)
		 use-explicit)
	(setq tag-text (buffer-substring explicit-start (1- (point)))))


      (if (looking-at "[0-9]")
	  (setq line (string-to-number (buffer-substring
                                        (point)
                                        (progn (skip-chars-forward "0-9")
                                               (point))))))
      (search-forward ",")
      (if (looking-at "[0-9]")
	  (setq startpos (string-to-number (buffer-substring
                                            (point)
                                            (progn (skip-chars-forward "0-9")
                                                   (point)))))))
    ;; Leave point on the next line of the tags file.
    (forward-line 1)
    (cons tag-text (cons line startpos))))