[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r105042: * lisp/abbrev.el (expand-abb
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r105042: * lisp/abbrev.el (expand-abbrev): Try to preserve point. |
Date: |
Fri, 08 Jul 2011 10:42:36 -0400 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 105042
fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5805
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2011-07-08 10:42:36 -0400
message:
* lisp/abbrev.el (expand-abbrev): Try to preserve point.
modified:
lisp/ChangeLog
lisp/abbrev.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-07-08 14:25:25 +0000
+++ b/lisp/ChangeLog 2011-07-08 14:42:36 +0000
@@ -1,3 +1,7 @@
+2011-07-08 Stefan Monnier <address@hidden>
+
+ * abbrev.el (expand-abbrev): Try to preserve point (bug#5805).
+
2011-07-08 Michael Albinus <address@hidden>
* net/tramp-sh.el (tramp-sh-handle-start-file-process): Use a
=== modified file 'lisp/abbrev.el'
--- a/lisp/abbrev.el 2011-07-05 15:31:22 +0000
+++ b/lisp/abbrev.el 2011-07-08 14:42:36 +0000
@@ -814,19 +814,28 @@
(destructuring-bind (&optional sym name wordstart wordend)
(abbrev--before-point)
(when sym
- (unless (or ;; executing-kbd-macro
- noninteractive
- (window-minibuffer-p (selected-window)))
- ;; Add an undo boundary, in case we are doing this for
- ;; a self-inserting command which has avoided making one so far.
- (undo-boundary))
- ;; Now sym is the abbrev symbol.
- (setq last-abbrev-text name)
- (setq last-abbrev sym)
- (setq last-abbrev-location wordstart)
- ;; If this abbrev has an expansion, delete the abbrev
- ;; and insert the expansion.
- (abbrev-insert sym name wordstart wordend)))))
+ (let ((startpos (copy-marker (point) t))
+ (endmark (copy-marker wordend t)))
+ (unless (or ;; executing-kbd-macro
+ noninteractive
+ (window-minibuffer-p (selected-window)))
+ ;; Add an undo boundary, in case we are doing this for
+ ;; a self-inserting command which has avoided making one so far.
+ (undo-boundary))
+ ;; Now sym is the abbrev symbol.
+ (setq last-abbrev-text name)
+ (setq last-abbrev sym)
+ (setq last-abbrev-location wordstart)
+ ;; If this abbrev has an expansion, delete the abbrev
+ ;; and insert the expansion.
+ (prog1
+ (abbrev-insert sym name wordstart wordend)
+ ;; Yuck!! If expand-abbrev is called with point slightly
+ ;; further than the end of the abbrev, move point back to
+ ;; where it started.
+ (if (and (> startpos endmark)
+ (= (point) endmark)) ;Obey skeletons that move point.
+ (goto-char startpos))))))))
(defun unexpand-abbrev ()
"Undo the expansion of the last abbrev that expanded.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r105042: * lisp/abbrev.el (expand-abbrev): Try to preserve point.,
Stefan Monnier <=