]> code.delx.au - gnu-emacs/blobdiff - src/abbrev.c
(main) [MAC_OS8 || MAC_OSX && HAVE_CARBON]: Call syms_of_macselect.
[gnu-emacs] / src / abbrev.c
index 2939b138d3f79a9569526c3a9682f262a8e15098..ac132f20023f1a482215a9590229ff6d64f1e9b3 100644 (file)
@@ -1,5 +1,5 @@
 /* Primitives for word-abbrev mode.
-   Copyright (C) 1985, 1986, 1993, 1996, 1998, 2001
+   Copyright (C) 1985, 1986, 1993, 1996, 1998, 2001,02,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -303,7 +303,7 @@ Returns the abbrev symbol, if expansion took place.  */)
          c = FETCH_BYTE (idx_byte);
          idx++, idx_byte++;
        }
-         
+
       if (UPPERCASEP (c))
        c = DOWNCASE (c), uccount++;
       else if (! NOCASEP (c))
@@ -356,10 +356,13 @@ Returns the abbrev symbol, if expansion took place.  */)
     {
       SET_PT (wordstart);
 
-      del_range_both (wordstart, wordstart_byte, wordend, wordend_byte, 1);
-
       insert_from_string (expansion, 0, 0, SCHARS (expansion),
                          SBYTES (expansion), 1);
+      del_range_both (PT, PT_BYTE,
+                     wordend + (PT - wordstart),
+                     wordend_byte + (PT_BYTE - wordstart_byte),
+                     1);
+
       SET_PT (PT + whitecnt);
 
       if (uccount && !lccount)
@@ -537,7 +540,8 @@ is inserted.  Otherwise the description is an expression,
 a call to `define-abbrev-table', which would
 define the abbrev table NAME exactly as it is currently defined.
 
-Abbrevs marked as "system abbrevs" are omitted.  */)
+Abbrevs marked as "system abbrevs" are normally omitted.  However, if
+READABLE is non-nil, they are listed.  */)
      (name, readable)
      Lisp_Object name, readable;
 {
@@ -592,9 +596,9 @@ of the form (ABBREVNAME EXPANSION HOOK USECOUNT SYSTEMFLAG).
     }
   CHECK_VECTOR (table);
 
-  for (; !NILP (definitions); definitions = Fcdr (definitions))
+  for (; CONSP (definitions); definitions = XCDR (definitions))
     {
-      elt = Fcar (definitions);
+      elt = XCAR (definitions);
       name  = Fcar (elt);      elt = Fcdr (elt);
       exp   = Fcar (elt);      elt = Fcdr (elt);
       hook  = Fcar (elt);      elt = Fcdr (elt);
@@ -690,3 +694,6 @@ the current abbrev table before abbrev lookup happens.  */);
   defsubr (&Sinsert_abbrev_table_description);
   defsubr (&Sdefine_abbrev_table);
 }
+
+/* arch-tag: b721db69-f633-44a8-a361-c275acbdad7d
+   (do not change this comment) */