diff options
| author | Stefan Monnier | 2007-10-24 01:51:03 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-10-24 01:51:03 +0000 |
| commit | eb3d6c677b7bada9022bf4ae0e46407755c709e9 (patch) | |
| tree | 9197a97a20729e5f77bb4245cc0e3681d84a1706 | |
| parent | 0f7f11b785ad9e8f83f24babfe2a283ada657782 (diff) | |
| download | emacs-eb3d6c677b7bada9022bf4ae0e46407755c709e9.tar.gz emacs-eb3d6c677b7bada9022bf4ae0e46407755c709e9.zip | |
(reindent-then-newline-and-indent): Use a `move after
insert' kind of marker in the save-excursion.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/simple.el | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 258a6361427..0b3c86d4097 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-10-24 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * simple.el (reindent-then-newline-and-indent): Use a `move after | ||
| 4 | insert' kind of marker in the save-excursion. | ||
| 5 | |||
| 1 | 2007-10-23 Michael Albinus <michael.albinus@gmx.de> | 6 | 2007-10-23 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 7 | ||
| 3 | * net/tramp.el (tramp-set-file-uid-gid): Protect `call-process' | 8 | * net/tramp.el (tramp-set-file-uid-gid): Protect `call-process' |
diff --git a/lisp/simple.el b/lisp/simple.el index eb76cd490d4..317acdaff31 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -633,9 +633,16 @@ column specified by the function `current-left-margin'." | |||
| 633 | (newline) | 633 | (newline) |
| 634 | (save-excursion | 634 | (save-excursion |
| 635 | (goto-char pos) | 635 | (goto-char pos) |
| 636 | ;; Usually indent-according-to-mode should "preserve" point, but it is | 636 | ;; We are at EOL before the call to indent-according-to-mode, and |
| 637 | ;; not guaranteed; e.g. indent-to-left-margin doesn't. | 637 | ;; after it we usually are as well, but not always. We tried to |
| 638 | (save-excursion (indent-according-to-mode)) | 638 | ;; address it with `save-excursion' but that uses a normal marker |
| 639 | ;; whereas we need `move after insertion', so we do the save/restore | ||
| 640 | ;; by hand. | ||
| 641 | (setq pos (copy-marker pos t)) | ||
| 642 | (indent-according-to-mode) | ||
| 643 | (goto-char pos) | ||
| 644 | ;; Remove the trailing white-space after indentation because | ||
| 645 | ;; indentation may introduce the whitespace. | ||
| 639 | (delete-horizontal-space t)) | 646 | (delete-horizontal-space t)) |
| 640 | (indent-according-to-mode))) | 647 | (indent-according-to-mode))) |
| 641 | 648 | ||