From: Kelly Dean Date: Wed, 18 Feb 2015 07:41:10 +0000 (+0000) Subject: Push mark before goto-char in jump-to-register and check-parens X-Git-Tag: emacs-25.0.90~2564^2~353 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b1d6ddd44614c84746f5ee494e1f29cd9be8a2d8;p=emacs.git Push mark before goto-char in jump-to-register and check-parens * register.el (jump-to-register): * emacs-lisp/lisp.el (check-parens): Push mark before goto-char so user doesn't lose his previous place. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a15295f4b4e..b71b55d8477 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2015-02-18 Kelly Dean + + * register.el (jump-to-register): + * emacs-lisp/lisp.el (check-parens): + Push mark before goto-char so user doesn't lose his previous place. + 2015-02-18 Kelly Dean * rect.el (rectangle-mark-mode): diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index fb631a73da1..67d14872b3a 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -714,7 +714,8 @@ character." (condition-case data ;; Buffer can't have more than (point-max) sexps. (scan-sexps (point-min) (point-max)) - (scan-error (goto-char (nth 2 data)) + (scan-error (push-mark) + (goto-char (nth 2 data)) ;; Could print (nth 1 data), which is either ;; "Containing expression ends prematurely" or ;; "Unbalanced parentheses", but those may not be so diff --git a/lisp/register.el b/lisp/register.el index 053657bd8cb..7afbc06c7fc 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -254,6 +254,9 @@ Interactively, reads the register using `register-read-with-preview'." (or (marker-buffer val) (user-error "That register's buffer no longer exists")) (switch-to-buffer (marker-buffer val)) + (unless (or (= (point) (marker-position val)) + (eq last-command 'jump-to-register)) + (push-mark)) (goto-char val)) ((and (consp val) (eq (car val) 'file)) (find-file (cdr val)))