]> code.delx.au - gnu-emacs/blobdiff - src/editfns.c
(find_field): Use EQ, not ==, to compare lisp objects.
[gnu-emacs] / src / editfns.c
index 10a52ca2ee63f73057cdfe170c806a4145b7bbfc..d3fa9c54f4763bf0f1f3886d8423c7c0bfc60dd7 100644 (file)
@@ -440,7 +440,7 @@ find_field (pos, merge_at_boundary, beg, end)
     else
       /* Find the previous field boundary.  */
       {
-       if (!NILP (merge_at_boundary) && before_field == Qboundary)
+       if (!NILP (merge_at_boundary) && EQ (before_field, Qboundary))
          /* Skip a `boundary' field.  */
          pos = Fprevious_single_char_property_change (pos, Qfield, Qnil,Qnil);
 
@@ -456,7 +456,7 @@ find_field (pos, merge_at_boundary, beg, end)
     else
       /* Find the next field boundary.  */
       {
-       if (!NILP (merge_at_boundary) && after_field == Qboundary)
+       if (!NILP (merge_at_boundary) && EQ (after_field, Qboundary))
          /* Skip a `boundary' field.  */
          pos = Fnext_single_char_property_change (pos, Qfield, Qnil, Qnil);
 
@@ -593,20 +593,23 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil.")
       else
        field_bound = Ffield_beginning (old_pos, escape_from_edge);
 
-      if (/* If ONLY_IN_LINE is non-nil, we only constrain NEW_POS if doing
-            so would remain within the same line.  */
-         NILP (only_in_line)
-         /* In that case, see if ESCAPE_FROM_EDGE caused FIELD_BOUND
-             to jump to the other side of NEW_POS, which would mean
-             that NEW_POS is already acceptable, and that we don't
-             have to do the line-check.  */
-         || ((XFASTINT (field_bound) < XFASTINT (new_pos)) ? !fwd : fwd)
-         /* If not, see if there's no newline intervening between
-             NEW_POS and FIELD_BOUND.  */
-         || (scan_buffer ('\n',
-                          XFASTINT (new_pos), XFASTINT (field_bound),
-                          fwd ? -1 : 1, &shortage, 1),
-             shortage != 0))
+      if (/* See if ESCAPE_FROM_EDGE caused FIELD_BOUND to jump to the
+             other side of NEW_POS, which would mean that NEW_POS is
+             already acceptable, and it's not necessary to constrain it
+             to FIELD_BOUND.  */
+         ((XFASTINT (field_bound) < XFASTINT (new_pos)) ? fwd : !fwd)
+         /* NEW_POS should be constrained, but only if either
+            ONLY_IN_LINE is nil (in which case any constraint is OK),
+            or NEW_POS and FIELD_BOUND are on the same line (in which
+            case the constraint is OK even if ONLY_IN_LINE is non-nil). */
+         && (NILP (only_in_line)
+             /* This is the ONLY_IN_LINE case, check that NEW_POS and
+                FIELD_BOUND are on the same line by seeing whether
+                there's an intervening newline or not.  */
+             || (scan_buffer ('\n',
+                              XFASTINT (new_pos), XFASTINT (field_bound),
+                              fwd ? -1 : 1, &shortage, 1),
+                 shortage != 0)))
        /* Constrain NEW_POS to FIELD_BOUND.  */
        new_pos = field_bound;
 
@@ -3587,7 +3590,7 @@ Transposing beyond buffer boundaries is an error.")
           bcopy (start1_addr, start1_addr + len2_byte, len1_byte);
           bcopy (temp, start1_addr, len2_byte);
          if (len2_byte > 20000)
-           free (temp);
+           xfree (temp);
         }
       else
        /* First region not smaller than second.  */
@@ -3602,7 +3605,7 @@ Transposing beyond buffer boundaries is an error.")
           bcopy (start2_addr, start1_addr, len2_byte);
           bcopy (temp, start1_addr + len2_byte, len1_byte);
          if (len1_byte > 20000)
-           free (temp);
+           xfree (temp);
         }
       graft_intervals_into_buffer (tmp_interval1, start1 + len2,
                                    len1, current_buffer, 0);
@@ -3640,7 +3643,7 @@ Transposing beyond buffer boundaries is an error.")
           bcopy (start2_addr, start1_addr, len2_byte);
           bcopy (temp, start2_addr, len1_byte);
          if (len1_byte > 20000)
-           free (temp);
+           xfree (temp);
           graft_intervals_into_buffer (tmp_interval1, start2,
                                        len1, current_buffer, 0);
           graft_intervals_into_buffer (tmp_interval2, start1,
@@ -3670,7 +3673,7 @@ Transposing beyond buffer boundaries is an error.")
           safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
           bcopy (temp, start1_addr, len2_byte);
          if (len2_byte > 20000)
-           free (temp);
+           xfree (temp);
           graft_intervals_into_buffer (tmp_interval1, end2 - len1,
                                        len1, current_buffer, 0);
           graft_intervals_into_buffer (tmp_interval_mid, start1 + len2,
@@ -3702,7 +3705,7 @@ Transposing beyond buffer boundaries is an error.")
           bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
           bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte);
          if (len1_byte > 20000)
-           free (temp);
+           xfree (temp);
           graft_intervals_into_buffer (tmp_interval1, end2 - len1,
                                        len1, current_buffer, 0);
           graft_intervals_into_buffer (tmp_interval_mid, start1 + len2,