Mercurial > emacs
changeset 85602:9a8400cb685c
(reindent-then-newline-and-indent): Use a `move after
insert' kind of marker in the save-excursion.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 24 Oct 2007 01:51:03 +0000 |
parents | 7b879ab0abb9 |
children | 819d86e241bc |
files | lisp/ChangeLog lisp/simple.el |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Oct 23 22:46:42 2007 +0000 +++ b/lisp/ChangeLog Wed Oct 24 01:51:03 2007 +0000 @@ -1,3 +1,8 @@ +2007-10-24 Stefan Monnier <monnier@iro.umontreal.ca> + + * simple.el (reindent-then-newline-and-indent): Use a `move after + insert' kind of marker in the save-excursion. + 2007-10-23 Michael Albinus <michael.albinus@gmx.de> * net/tramp.el (tramp-set-file-uid-gid): Protect `call-process'
--- a/lisp/simple.el Tue Oct 23 22:46:42 2007 +0000 +++ b/lisp/simple.el Wed Oct 24 01:51:03 2007 +0000 @@ -633,9 +633,16 @@ (newline) (save-excursion (goto-char pos) - ;; Usually indent-according-to-mode should "preserve" point, but it is - ;; not guaranteed; e.g. indent-to-left-margin doesn't. - (save-excursion (indent-according-to-mode)) + ;; We are at EOL before the call to indent-according-to-mode, and + ;; after it we usually are as well, but not always. We tried to + ;; address it with `save-excursion' but that uses a normal marker + ;; whereas we need `move after insertion', so we do the save/restore + ;; by hand. + (setq pos (copy-marker pos t)) + (indent-according-to-mode) + (goto-char pos) + ;; Remove the trailing white-space after indentation because + ;; indentation may introduce the whitespace. (delete-horizontal-space t)) (indent-according-to-mode)))