aboutsummaryrefslogtreecommitdiff
path: root/helpful.el
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2018-05-22 20:23:32 +0100
committerWilfred Hughes <me@wilfred.me.uk>2018-05-22 20:23:32 +0100
commit5d0796faa829aebe7b5f73054e0cfab16b4b0860 (patch)
treee5f5720f3cc2802e64390829ba58df7ae32da148 /helpful.el
parent8b60a24f330f42ccda8431e7683557455874a3c4 (diff)
Show preceding comments and autoload cookies in source0.10
Diffstat (limited to 'helpful.el')
-rw-r--r--helpful.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/helpful.el b/helpful.el
index feb4bce..aaa7ed4 100644
--- a/helpful.el
+++ b/helpful.el
@@ -950,7 +950,12 @@ If the source code cannot be found, return the sexp used."
(save-excursion
(save-restriction
(goto-char start-pos)
- (narrow-to-defun)
+ (narrow-to-defun t)
+
+ ;; If there was a preceding comment, START-POS will be
+ ;; after that comment. Move the position to include that comment.
+ (setq start-pos (point-min))
+
(setq source (buffer-substring-no-properties (point-min) (point-max))))))
(setq source (s-trim-right source))
(when (and source (buffer-file-name buf))