changeset 3731:ca1e006fff42

(dabbrev-expand): Do all changes with replace-match. In picture-mode, use picture-replace-match instead.
author Richard M. Stallman <rms@gnu.org>
date Mon, 14 Jun 1993 18:55:10 +0000
parents 473c03886fc2
children 60292a8697bc
files lisp/dabbrev.el
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dabbrev.el	Mon Jun 14 18:53:40 1993 +0000
+++ b/lisp/dabbrev.el	Mon Jun 14 18:55:10 1993 +0000
@@ -162,8 +162,10 @@
 	  (setq last-dabbrevs-abbrev-location nil)
 	  (if (not first)
 	      (progn (undo-boundary)
-		     (delete-backward-char (length old))
-		     (insert abbrev)))
+		     (search-backward old)
+		     (if (eq major-mode 'picture-mode)
+			 (picture-replace-match abbrev t 'literal)
+		       (replace-match abbrev t 'literal))))
 	  (error (if first
 		     "No dynamic expansion for \"%s\" found."
 		     "No further dynamic expansions for \"%s\" found.")
@@ -177,7 +179,9 @@
       ;; First put back the original abbreviation with its original
       ;; case pattern.
       (save-excursion
-	(replace-match abbrev t 'literal))
+	(if (eq major-mode 'picture-mode)
+	    (picture-replace-match abbrev t 'literal)
+	  (replace-match abbrev t 'literal)))
       (search-forward abbrev)
       (let ((do-case (and do-case
 			  (string= (substring expansion 1)
@@ -189,9 +193,13 @@
 ;;; This used to be necessary, but no longer, 
 ;;; because now point is preserved correctly above.
 ;;;	(search-forward abbrev)
-	(replace-match (if do-case (downcase expansion) expansion)
-		       (not do-case)
-		       'literal))
+	(if (eq major-mode 'picture-mode)
+	    (picture-replace-match (if do-case (downcase expansion) expansion)
+				   (not do-case)
+				   'literal)
+	  (replace-match (if do-case (downcase expansion) expansion)
+			 (not do-case)
+			 'literal)))
       ;; Save state for re-expand.
       (setq last-dabbrevs-abbreviation abbrev)
       (setq last-dabbrevs-expansion expansion)