diff options
author | Stefan Monnier <[email protected]> | 2007-10-24 01:51:03 +0000 |
---|---|---|
committer | Stefan Monnier <[email protected]> | 2007-10-24 01:51:03 +0000 |
commit | eb3d6c677b7bada9022bf4ae0e46407755c709e9 (patch) | |
tree | 9197a97a20729e5f77bb4245cc0e3681d84a1706 /lisp/simple.el | |
parent | 0f7f11b785ad9e8f83f24babfe2a283ada657782 (diff) |
(reindent-then-newline-and-indent): Use a `move after
insert' kind of marker in the save-excursion.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index eb76cd490d..317acdaff3 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -633,9 +633,16 @@ column specified by the function `current-left-margin'." (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))) |