summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/simple.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 7cb71530b36..6bc41961eba 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1259,7 +1259,11 @@ that uses or sets the mark."
;; In a narrowed buffer.
(if relative " relative" " absolute"))
buffer-prompt)
- (list default (line-number-at-pos))
+ (list default (if (or relative (= (point-min) 1))
+ (line-number-at-pos)
+ (save-restriction
+ (widen)
+ (line-number-at-pos))))
'goto-line-history)
buffer))))