commit d5a01600e78f25e89abe4c577eba2aea62952c38
parent d549cc0e6feea81ae53f08bbedcdf01272440b5b
Author: Wilfred Hughes <me@wilfred.me.uk>
Date: Sun, 10 Dec 2017 11:33:23 +0000
Preserve point position more precisely
Going the previous char position is inaccurate if the amount of text
on each line has changed.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/helpful.el b/helpful.el
@@ -523,7 +523,8 @@ state of the current symbol."
(interactive)
(cl-assert (not (null helpful--sym)))
(let* ((inhibit-read-only t)
- (start-pos (point))
+ (start-line (line-number-at-pos))
+ (start-column (current-column))
(primitive-p (helpful--primitive-p
helpful--sym helpful--callable-p))
(look-for-src (or (not primitive-p)
@@ -670,7 +671,9 @@ state of the current symbol."
(t
(helpful--syntax-highlight
(helpful--pretty-print source))))))
- (goto-char start-pos)))
+ (goto-char (point-min))
+ (forward-line (1- start-line))
+ (forward-char start-column)))
(defun helpful--skip-advice (docstring)
"Remove mentions of advice from DOCSTRING."