]> code.delx.au - gnu-emacs/blobdiff - lisp/dabbrev.el
entered into RCS
[gnu-emacs] / lisp / dabbrev.el
index 476a36b37fb8b4984e8b999b733f31c7c5704841..d2f746b6c3191ae2eec155308f3ff59ef1028dc6 100644 (file)
@@ -1,10 +1,13 @@
 ;;; dabbrev.el --- dynamic abbreviation package for GNU Emacs.
 
-;; Maintainer: FSF
-;; Last-Modified: 16 Mar 1992
+;; Copyright (C) 1985, 1986 Free Software Foundation, Inc.
 
+;; Last-Modified: 16 Mar 1992
 ;; Copyright (C) 1985, 1986 Free Software Foundation, Inc.
 
+;; Maintainer: FSF
+;; Keywords: abbrev
+
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -159,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.")
@@ -174,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)
@@ -183,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)
@@ -262,6 +275,6 @@ with the next possible expansion not yet tried."
                   (setq result (downcase result))))))
       result)))
 
-(provide 'dabbrevs)
+(provide 'dabbrev)
 
 ;;; dabbrev.el ends here