commit 387997b844f426781dc94ee295d177d32b38be5e
parent 3b1b2c2661efcd2fac729d1c67f111055d9381fb
Author: Wilfred Hughes <me@wilfred.me.uk>
Date: Wed, 5 Apr 2017 08:38:18 +0100
Try harder to find source file
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/helpful.el b/helpful.el
@@ -132,8 +132,14 @@ If the source code cannot be found, return the sexp used."
(ignore-errors
(setq buf-and-pos
(find-function-noselect sym)))
- (pcase buf-and-pos
- (`(,buf . ,_) (abbreviate-file-name (buffer-file-name buf))))))
+ (if buf-and-pos
+ (pcase buf-and-pos
+ (`(,buf . ,_) (abbreviate-file-name (buffer-file-name buf))))
+ ;; If it's defined interactively, it may have an edebug property
+ ;; that tells us where it's defined.
+ (-when-let (marker
+ (get #'helpful--format-position-heads 'edebug))
+ (buffer-file-name (marker-buffer marker))))))
(defun helpful--reference-positions (sym buf)
(-let* ((forms-and-bufs