aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-07-30 07:08:49 +0000
committerRichard M. Stallman1995-07-30 07:08:49 +0000
commit4209f4792123e8e44e9aba12fc080432b89bb9f4 (patch)
tree1d5b0904888469dd30f8e40354f050856595bc53
parent79dbff47727219cf8f79c3ea766c6807f3962e3b (diff)
downloademacs-4209f4792123e8e44e9aba12fc080432b89bb9f4.tar.gz
emacs-4209f4792123e8e44e9aba12fc080432b89bb9f4.zip
(dabbrev-expand): Save previous point for undo.
-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.
415 415
416See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]." 416See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
417 (interactive "*P") 417 (interactive "*P")
418 (let (abbrev expansion old direction) 418 (let (abbrev expansion old direction (orig-point (point)))
419 ;; abbrev -- the abbrev to expand 419 ;; abbrev -- the abbrev to expand
420 ;; expansion -- the expansion found (eventually) or nil until then 420 ;; expansion -- the expansion found (eventually) or nil until then
421 ;; old -- the text currently in the buffer 421 ;; old -- the text currently in the buffer
@@ -489,6 +489,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
489 (dabbrev--reset-global-variables) 489 (dabbrev--reset-global-variables)
490 (if old 490 (if old
491 (save-excursion 491 (save-excursion
492 (setq buffer-undo-list (cons orig-point buffer-undo-list))
492 (search-backward (substring old (length abbrev))) 493 (search-backward (substring old (length abbrev)))
493 (delete-region (match-beginning 0) (match-end 0)))) 494 (delete-region (match-beginning 0) (match-end 0))))
494 (error "No%s dynamic expansion for `%s' found" 495 (error "No%s dynamic expansion for `%s' found"
@@ -507,6 +508,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
507 (setq dabbrev--last-expansion-location 508 (setq dabbrev--last-expansion-location
508 (copy-marker dabbrev--last-expansion-location))) 509 (copy-marker dabbrev--last-expansion-location)))
509 ;; Success: stick it in and return. 510 ;; Success: stick it in and return.
511 (setq buffer-undo-list (cons orig-point buffer-undo-list))
510 (dabbrev--substitute-expansion old abbrev expansion) 512 (dabbrev--substitute-expansion old abbrev expansion)
511 ;; Save state for re-expand. 513 ;; Save state for re-expand.
512 (setq dabbrev--last-expansion expansion) 514 (setq dabbrev--last-expansion expansion)