Function: org-ctags-find-tag-at-point

org-ctags-find-tag-at-point is a byte-compiled function defined in org-ctags.el.gz.

Signature

(org-ctags-find-tag-at-point)

Documentation

Determine default tag to search for, based on text at point.

If there is no plausible default, return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-ctags.el.gz
(defun org-ctags-find-tag-at-point ()
  "Determine default tag to search for, based on text at point.
If there is no plausible default, return nil."
  (let (from to bound)
    (when (or (ignore-errors
		;; Look for hyperlink around `point'.
		(save-excursion
		  (search-backward "[[") (setq from (+ 2 (point))))
		(save-excursion
                  (goto-char from)
		  (search-forward "]") (setq to (- (point) 1)))
		(and (> to from) (>= (point) from) (<= (point) to)))
              (progn
		;; Look at text around `point'.
		(save-excursion
		  (skip-syntax-backward "w_") (setq from (point)))
		(save-excursion
		  (skip-syntax-forward "w_") (setq to (point)))
		(> to from))
	      ;; Look between `line-beginning-position' and `point'.
	      (save-excursion
		(and (setq bound (line-beginning-position))
		     (skip-syntax-backward "^w_" bound)
		     (> (setq to (point)) bound)
		     (skip-syntax-backward "w_")
		     (setq from (point))))
	      ;; Look between `point' and `line-end-position'.
	      (save-excursion
		(and (setq bound (line-end-position))
		     (skip-syntax-forward "^w_" bound)
		     (< (setq from (point)) bound)
		     (skip-syntax-forward "w_")
		     (setq to (point)))))
      (buffer-substring-no-properties from to))))