changeset 93011:b1cbc5b82a29

(goto-line): Leave mark at previous position. Doc fix.
author Juri Linkov <juri@jurta.org>
date Sun, 16 Mar 2008 17:44:31 +0000
parents 6bc37f1965b5
children b49a04359896
files lisp/simple.el
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sun Mar 16 17:44:20 2008 +0000
+++ b/lisp/simple.el	Sun Mar 16 17:44:31 2008 +0000
@@ -819,10 +819,11 @@
 
 (defun goto-line (arg &optional buffer)
   "Goto line ARG, counting from line 1 at beginning of buffer.
-Normally, move point in the current buffer.
-With just \\[universal-argument] as argument, move point in the most recently
-displayed other buffer, and switch to it.  When called from Lisp code,
-the optional argument BUFFER specifies a buffer to switch to.
+Normally, move point in the current buffer, and leave mark at previous
+position.  With just \\[universal-argument] as argument, move point
+in the most recently displayed other buffer, and switch to it.
+When called from Lisp code, the optional argument BUFFER specifies
+a buffer to switch to.
 
 If there's a number in the buffer at point, it is the default for ARG."
   (interactive
@@ -859,6 +860,9 @@
       (let ((window (get-buffer-window buffer)))
 	(if window (select-window window)
 	  (switch-to-buffer-other-window buffer))))
+  ;; Leave mark at previous position
+  (or (and transient-mark-mode mark-active)
+      (push-mark))
   ;; Move to the specified line number in that buffer.
   (save-restriction
     (widen)