Fix 'reindent-then-newline-and-indent' with 'abbrev-mode'
authorEli Zaretskii <eliz@gnu.org>
Sat, 15 Jun 2024 10:04:12 +0000 (13:04 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 15 Jun 2024 10:04:12 +0000 (13:04 +0300)
* lisp/simple.el (reindent-then-newline-and-indent): Use a marker
for the initial position.  (Bug#71459)

lisp/simple.el

index 74115be27788b687a7fdb80a35bef59f72da5024..b48f46fc711f020d28f5ab7ec3ec057e8ce78100 100644 (file)
@@ -915,7 +915,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.