Function: speedbar-extract-one-symbol
speedbar-extract-one-symbol is a byte-compiled function defined in
speedbar.el.gz.
Signature
(speedbar-extract-one-symbol EXPR)
Documentation
At point, return nil, or one alist in the form (SYMBOL . POSITION).
The line should contain output from etags. Parse the output using the regular expression EXPR.
Source Code
;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
;; This bit donated by Farzin Guilak <farzin@protocol.com> but I'm not
;; sure it's needed with the different sorting method.
;;
;(defun speedbar-clean-etags()
; "Removes spaces before the ^? character, and removes `#define',
;return types, etc. preceding tags. This ensures that the sort operation
;works on the tags, not the return types."
; (save-excursion
; (goto-char (point-min))
; (while
; (re-search-forward "(?[ \t](?\C-?" nil t)
; (replace-match "\C-?" nil nil))
; (goto-char (point-min))
; (while
; (re-search-forward "\\(.*[ \t]+\\)\\([^ \t\n]+.*\C-?\\)" nil t)
; (delete-region (match-beginning 1) (match-end 1)))))
(defun speedbar-extract-one-symbol (expr)
"At point, return nil, or one alist in the form (SYMBOL . POSITION).
The line should contain output from etags. Parse the output using the
regular expression EXPR."
(let* ((sym (if (stringp expr)
(if (save-excursion
(re-search-forward expr (line-end-position) t))
(buffer-substring-no-properties (match-beginning 1)
(match-end 1)))
(funcall expr)))
(pos (let ((j (re-search-forward "[\C-?\C-a]\\([0-9]+\\),\\([0-9]+\\)"
(line-end-position) t)))
(if (and j sym)
(1+ (string-to-number (buffer-substring-no-properties
(match-beginning 2)
(match-end 2))))
0))))
(if (/= pos 0)
(cons sym pos)
nil)))