]> code.delx.au - gnu-emacs/blobdiff - lisp/dabbrev.el
entered into RCS
[gnu-emacs] / lisp / dabbrev.el
index 3c1d967629a449894d6213cb15325321ec8cd708..d2f746b6c3191ae2eec155308f3ff59ef1028dc6 100644 (file)
@@ -6,6 +6,7 @@
 ;; Copyright (C) 1985, 1986 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
+;; Keywords: abbrev
 
 ;; This file is part of GNU Emacs.
 
@@ -161,8 +162,10 @@ with the next possible expansion not yet tried."
          (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.")
@@ -176,7 +179,9 @@ with the next possible expansion not yet tried."
       ;; 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)
@@ -185,10 +190,16 @@ with the next possible expansion not yet tried."
        ;; case pattern.
        (save-excursion
          (replace-match abbrev t 'literal))
-       (search-forward abbrev)
-       (replace-match (if do-case (downcase expansion) expansion)
-                      (not do-case)
-                      'literal))
+;;; This used to be necessary, but no longer, 
+;;; because now point is preserved correctly above.
+;;;    (search-forward abbrev)
+       (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)