]> git.eshelyaron.com Git - emacs.git/commitdiff
(expand-abbrev): Move point back to expansion's end.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 4 Nov 2007 02:57:52 +0000 (02:57 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 4 Nov 2007 02:57:52 +0000 (02:57 +0000)
lisp/ChangeLog
lisp/abbrev.el

index 97cb6f7425a1662ea4385d5c0129c7e4ecde0a31..4964ad5732e1f286a38e00dadbf7bc717d727d3f 100644 (file)
@@ -1,3 +1,7 @@
+2007-11-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * abbrev.el (expand-abbrev): Move point back to expansion's end.
+
 2007-11-04  Glenn Morris  <rgm@gnu.org>
 
        * net/tls.el: Don't require rx when compiling.
@@ -18,8 +22,8 @@
 
 2007-11-03  Michael Olson  <mwolson@gnu.org>
 
-       * textmodes/remember.el (remember-buffer): Use
-       define-obsolete-function-alias rather than defalias.
+       * textmodes/remember.el (remember-buffer):
+       Use define-obsolete-function-alias rather than defalias.
 
 2007-11-03  Ulrich Mueller  <ulm@gentoo.org>  (tiny change)
 
@@ -35,8 +39,8 @@
        uncomment-region-function and comment-insert-comment-function.
        (fortran-uncomment-region): New function.
 
-       * textmodes/nroff-mode.el (nroff-mode): Set
-       comment-insert-comment-function rather than indent-line-function.
+       * textmodes/nroff-mode.el (nroff-mode):
+       Set comment-insert-comment-function rather than indent-line-function.
        (nroff-indent-line-function): Remove.
        (nroff-insert-comment-function): New function.
 
index 87a31df8112a51ef242453aceb6523e8d299981f..74a0bbf29b944273747a2781f4ef52176018637d 100644 (file)
@@ -753,9 +753,11 @@ Returns the abbrev symbol, if expansion took place."
           ;; If this abbrev has an expansion, delete the abbrev
           ;; and insert the expansion.
           (when (stringp (symbol-value sym))
-            (goto-char wordend)
+            (goto-char wordstart)
+            ;; Insert at beginning so that markers at the end (e.g. point)
+            ;; are preserved.
             (insert (symbol-value sym))
-            (delete-region wordstart wordend)
+            (delete-char (- wordend wordstart))
             (let ((case-fold-search nil))
               ;; If the abbrev's name is different from the buffer text (the
               ;; only difference should be capitalization), then we may want
@@ -778,7 +780,10 @@ Returns the abbrev symbol, if expansion took place."
                     (goto-char wordstart)
                     (skip-syntax-forward "^w" (1- end))
                     ;; Change just that.
-                    (upcase-initials-region (point) (1+ (point))))))))
+                    (upcase-initials-region (point) (1+ (point)))
+                    (goto-char end))))))
+          ;; Now point is at the end of the expansion and the beginning is
+          ;; in last-abbrev-location.
           (when (symbol-function sym)
             (let* ((hook (symbol-function sym))
                    (expanded