]> code.delx.au - gnu-emacs-elpa/commitdiff
avy.el (avy-goto-line): fix for narrowed regions
authorAleksey Fedotov <a.fedotov@samsung.com>
Fri, 18 Dec 2015 18:43:16 +0000 (21:43 +0300)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 19 Dec 2015 14:30:47 +0000 (15:30 +0100)
When 'avy-goto-line' is called with numbered argument, it tries to mimic
behaviour of 'goto-line'. However, if some part of text is hidden by
narrowing, 'avy-goto-line' failed to account for that.

This patch temporarily disables narrowing, jumps on line and then
restores narrowing, just like 'goto-line' does.

Fixes #122
Fixes #123

avy.el

diff --git a/avy.el b/avy.el
index 4426a222860342372aacbe6670cc54d79e839491..089121be56b7f1c7292f5403d63b0b666ee109a5 100644 (file)
--- a/avy.el
+++ b/avy.el
@@ -1070,8 +1070,10 @@ Otherwise, forward to `goto-line' with ARG."
                                "Goto line: " (string char))))
                     (when line
                       (avy-push-mark)
-                      (goto-char (point-min))
-                      (forward-line (1- (string-to-number line)))
+                      (save-restriction
+                        (widen)
+                        (goto-char (point-min))
+                        (forward-line (1- (string-to-number line))))
                       (throw 'done 'exit))))))
              (r (avy--line (eq arg 4))))
         (unless (eq r t)