Skip to content

Commit

Permalink
find at point
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Sep 2, 2008
1 parent af9998e commit b0957c3
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion emacs.d/defunkt/helpers.el
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,24 @@
((file-directory-p suffix) (add-to-list 'load-path suffix) (require library))
((file-exists-p suffix) (require library)))
(when (file-exists-p (concat defunkt ".el"))
(load defunkt))))
(load defunkt))))

(defun find-thing-at-point (&optional always-ask)
(interactive "P")
(let* ((at-point (thing-at-point 'symbol))
(s (and at-point (intern at-point)))
(v (or (variable-at-point)
(and s (boundp s) s)))
(f (or (function-called-at-point)
(and s (fboundp s) s))))
(push-mark (point) t)
(cond
(always-ask (call-interactively 'find-function))
((and v (not (numberp v)))
(find-variable v))
((and f (subrp (symbol-function f)))
(let ((buf-pos (find-function-search-for-symbol
f nil (help-C-file-name (symbol-function f) 'subr))))
(and (car buf-pos) (pop-to-buffer (car buf-pos)))))
(f (find-function f))
(t (call-interactively 'find-function)))))

0 comments on commit b0957c3

Please sign in to comment.