aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-06-14 18:55:10 +0000
committerRichard M. Stallman1993-06-14 18:55:10 +0000
commit0fc2d0064d82d0d2cab1587a44e9b00e5c934a00 (patch)
treece7726bce6f11fa75f6cff3c3ea97f9261abda80
parent5c927015eeba89a83299536e7b2ffcf294fdbc6c (diff)
downloademacs-0fc2d0064d82d0d2cab1587a44e9b00e5c934a00.tar.gz
emacs-0fc2d0064d82d0d2cab1587a44e9b00e5c934a00.zip
(dabbrev-expand): Do all changes with replace-match.
In picture-mode, use picture-replace-match instead.
-rw-r--r--lisp/dabbrev.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index db5fcacd077..d2f746b6c31 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -162,8 +162,10 @@ with the next possible expansion not yet tried."
162 (setq last-dabbrevs-abbrev-location nil) 162 (setq last-dabbrevs-abbrev-location nil)
163 (if (not first) 163 (if (not first)
164 (progn (undo-boundary) 164 (progn (undo-boundary)
165 (delete-backward-char (length old)) 165 (search-backward old)
166 (insert abbrev))) 166 (if (eq major-mode 'picture-mode)
167 (picture-replace-match abbrev t 'literal)
168 (replace-match abbrev t 'literal))))
167 (error (if first 169 (error (if first
168 "No dynamic expansion for \"%s\" found." 170 "No dynamic expansion for \"%s\" found."
169 "No further dynamic expansions for \"%s\" found.") 171 "No further dynamic expansions for \"%s\" found.")
@@ -177,7 +179,9 @@ with the next possible expansion not yet tried."
177 ;; First put back the original abbreviation with its original 179 ;; First put back the original abbreviation with its original
178 ;; case pattern. 180 ;; case pattern.
179 (save-excursion 181 (save-excursion
180 (replace-match abbrev t 'literal)) 182 (if (eq major-mode 'picture-mode)
183 (picture-replace-match abbrev t 'literal)
184 (replace-match abbrev t 'literal)))
181 (search-forward abbrev) 185 (search-forward abbrev)
182 (let ((do-case (and do-case 186 (let ((do-case (and do-case
183 (string= (substring expansion 1) 187 (string= (substring expansion 1)
@@ -189,9 +193,13 @@ with the next possible expansion not yet tried."
189;;; This used to be necessary, but no longer, 193;;; This used to be necessary, but no longer,
190;;; because now point is preserved correctly above. 194;;; because now point is preserved correctly above.
191;;; (search-forward abbrev) 195;;; (search-forward abbrev)
192 (replace-match (if do-case (downcase expansion) expansion) 196 (if (eq major-mode 'picture-mode)
193 (not do-case) 197 (picture-replace-match (if do-case (downcase expansion) expansion)
194 'literal)) 198 (not do-case)
199 'literal)
200 (replace-match (if do-case (downcase expansion) expansion)
201 (not do-case)
202 'literal)))
195 ;; Save state for re-expand. 203 ;; Save state for re-expand.
196 (setq last-dabbrevs-abbreviation abbrev) 204 (setq last-dabbrevs-abbreviation abbrev)
197 (setq last-dabbrevs-expansion expansion) 205 (setq last-dabbrevs-expansion expansion)