From 07a6a9200b392a9f717957a139cdce9d38ddde33 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 15 Jun 2024 13:04:12 +0300 Subject: [PATCH] Fix 'reindent-then-newline-and-indent' with 'abbrev-mode' * lisp/simple.el (reindent-then-newline-and-indent): Use a marker for the initial position. (Bug#71459) (cherry picked from commit ffa349f983fa5c754fd7751c0757f6c704fbfe5a) --- lisp/simple.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 8d8e898823e..b2e843ed882 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -927,7 +927,9 @@ In programming language modes, this is the same as TAB. In some text modes, where TAB inserts a tab, this indents to the column specified by the function `current-left-margin'." (interactive "*") - (let ((pos (point)) + ;; Use a marker because the call to 'newline' below could insert some + ;; text, e.g., if 'abbrev-mode' is turned on. + (let ((pos (point-marker)) (electric-indent-mode nil)) ;; Be careful to insert the newline before indenting the line. ;; Otherwise, the indentation might be wrong. -- 2.39.2