]> git.eshelyaron.com Git - emacs.git/commitdiff
Stop abbrev-prefix-mark from adding extra newline (Bug#25767)
authorAllen Li <vianchielfaura@gmail.com>
Thu, 2 Mar 2017 12:56:53 +0000 (07:56 -0500)
committerNoam Postavsky <npostavs@gmail.com>
Fri, 3 Mar 2017 00:01:18 +0000 (19:01 -0500)
`abbrev--before-point' does not adjust `pos' to account for when it
deletes the "-" left by abbrev-prefix-mark.  Therefore, when
`abbrev-before-point' goes to restore point, it moves point one
character too far forward.

* lisp/abbrev.el (abbrev--before-point): Adjust pos when deleting "-".

lisp/abbrev.el

index cbc604c23d695e92bd3e61474812e07f6c3ec285..01ad3d478fcd3b6a4df9262e9a40892f4a7cc46f 100644 (file)
@@ -720,9 +720,10 @@ then ABBREV is looked up in that table only."
           (setq start abbrev-start-location)
           (setq abbrev-start-location nil)
           ;; Remove the hyphen inserted by `abbrev-prefix-mark'.
-          (if (and (< start (point-max))
-                   (eq (char-after start) ?-))
-              (delete-region start (1+ start)))
+          (when (and (< start (point-max))
+                     (eq (char-after start) ?-))
+            (delete-region start (1+ start))
+            (setq pos (1- pos)))
           (skip-syntax-backward " ")
           (setq end (point))
           (when (> end start)