     (when (string= tagname "")
       (setq tagname (find-tag-default)))
     (ectags-find tagname)))
-
-;; (defun c-eldoc-scope ()
-;;   "Try to figure out our scope."
-;;   (save-excursion
-;;     (c-end-of-defun)
-;;     (c-beginning-of-defun-1)
-;;     (forward-line -1)
-;;     (c-syntactic-re-search-forward "::")
-;;     (backward-char 2)
-;;     (when (c-on-identifier)
-;;       (let* ((id-end (point))
-;;              (id-start (progn (backward-char 1) (c-beginning-of-current-token) (point))))
-;;         (buffer-substring-no-properties id-start id-end)))))
 
 (defun ectags-current-symbol (&optional limit)
   "Finds the current function and position in argument list."

        (setq tag-info (replace-regexp-in-string "typeref:typename:" "type:" tag-info))
        tag-info))))

;; scoped version for cpp and the like : tries to find symbol in current scope first
;; scope format is a format string that concatenates the cureend scope and the symbol with the scope operator
;; eg "%s::%s" for c++
;;;###autoload
;; (defun ectags-eldoc-print-current-scoped-symbol-info ()
;;   "Try to find the meaning of the symbol in the current scope.  \
;; Probably only useful for cpp mode."
;;   (let* ((eldoc-scope (c-eldoc-scope))
;;          (eldoc-sym (ectags-current-symbol (- (point) 1000))))
;;     (when eldoc-sym
;;       (ectags-seek (format "%s::%s" eldoc-scope eldoc-sym))
;;       (if (> (length ectags--matches) 0)
;;           (format "%s::%s %s" eldoc-scope eldoc-sym (ectags-match-tag-info (car ectags--matches)))
;;         (progn
;;           (ectags-seek eldoc-sym)
;;           (if (> (length ectags--matches) 0)
;;               (format "%s %s" eldoc-sym (ectags-match-tag-info (car ectags--matches)))
;;             (if eldoc-scope
;;                 (format "Scope %s " eldoc-scope))
;;             (format "Unknown %s " eldoc-sym)))))))

;;;###autoload
;; (defun ectags-turn-on-eldoc-mode (&optional scope-format)
;;   (interactive)
;;   (if scope-format
;;       (set (make-local-variable 'eldoc-documentation-function)
;;            'ectags-eldoc-print-current-scoped-symbol-info)
;;     (set (make-local-variable 'eldoc-documentation-function)
;;          'ectags-print-current-symbol-info)
;;     (eldoc-mode)))

(defvar ectags-mode-map
  (let ((map (make-keymap)))
    (define-key map (kbd "<return>") #'ectags-goto-tag)


(defun ectags-scan-external ()
  "Search the `ectags--file-name' for the `ectags--regexp'.
Calls `ectags-match' for each line that matches."
  ;; vlf-re-search-forward - too slow
  ;; binary search - too slow and the tags file has to be sorted
