summaryrefslogtreecommitdiff
path: root/lisp/dabbrev.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-07-30 07:08:49 +0000
committerRichard M. Stallman <rms@gnu.org>1995-07-30 07:08:49 +0000
commit4209f4792123e8e44e9aba12fc080432b89bb9f4 (patch)
tree1d5b0904888469dd30f8e40354f050856595bc53 /lisp/dabbrev.el
parent79dbff47727219cf8f79c3ea766c6807f3962e3b (diff)
downloademacs-4209f4792123e8e44e9aba12fc080432b89bb9f4.tar.gz
(dabbrev-expand): Save previous point for undo.
Diffstat (limited to 'lisp/dabbrev.el')
-rw-r--r--lisp/dabbrev.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 438ad165559..a28c9023571 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -415,7 +415,7 @@ direction of search to backward if set non-nil.
See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
(interactive "*P")
- (let (abbrev expansion old direction)
+ (let (abbrev expansion old direction (orig-point (point)))
;; abbrev -- the abbrev to expand
;; expansion -- the expansion found (eventually) or nil until then
;; old -- the text currently in the buffer
@@ -489,6 +489,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
(dabbrev--reset-global-variables)
(if old
(save-excursion
+ (setq buffer-undo-list (cons orig-point buffer-undo-list))
(search-backward (substring old (length abbrev)))
(delete-region (match-beginning 0) (match-end 0))))
(error "No%s dynamic expansion for `%s' found"
@@ -507,6 +508,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
(setq dabbrev--last-expansion-location
(copy-marker dabbrev--last-expansion-location)))
;; Success: stick it in and return.
+ (setq buffer-undo-list (cons orig-point buffer-undo-list))
(dabbrev--substitute-expansion old abbrev expansion)
;; Save state for re-expand.
(setq dabbrev--last-expansion expansion)