From: Eli Zaretskii Date: Sat, 15 Jun 2024 10:04:12 +0000 (+0300) Subject: Fix 'reindent-then-newline-and-indent' with 'abbrev-mode' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=07a6a9200b392a9f717957a139cdce9d38ddde33;p=emacs.git 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) --- 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.