Replace `iff' in comments.
[bpt/emacs.git] / src / editfns.c
index 5053119..6c6742d 100644 (file)
@@ -7,7 +7,7 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -274,7 +274,9 @@ clip_to_bounds (lower, num, upper)
 
 DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
        doc: /* Set point to POSITION, a number or marker.
-Beginning of buffer is position (point-min), end is (point-max).  */)
+Beginning of buffer is position (point-min), end is (point-max).
+
+The return value is POSITION.  */)
      (position)
      register Lisp_Object position;
 {
@@ -1729,7 +1731,7 @@ support.  MINUTE is an integer between 0 and 59.  HOUR is an integer
 between 0 and 23.  DAY is an integer between 1 and 31.  MONTH is an
 integer between 1 and 12.  YEAR is an integer indicating the
 four-digit year.  DOW is the day of week, an integer between 0 and 6,
-where 0 is Sunday.  DST is t if daylight savings time is effect,
+where 0 is Sunday.  DST is t if daylight saving time is in effect,
 otherwise nil.  ZONE is an integer indicating the number of seconds
 east of Greenwich.  (Note that Common Lisp has different meanings for
 DOW and ZONE.)  */)
@@ -1778,7 +1780,7 @@ This is the reverse operation of `decode-time', which see.
 ZONE defaults to the current time zone rule.  This can
 be a string or t (as from `set-time-zone-rule'), or it can be a list
 \(as from `current-time-zone') or an integer (as from `decode-time')
-applied without consideration for daylight savings time.
+applied without consideration for daylight saving time.
 
 You can pass more than 7 arguments; then the first six arguments
 are used as SECOND through YEAR, and the *last* argument is used as ZONE.
@@ -3514,7 +3516,7 @@ usage: (format STRING &rest OBJECTS)  */)
           precision    ::= '.' [0-9]*
 
           If a field-width is specified, it specifies to which width
-          the output should be padded with blanks, iff the output
+          the output should be padded with blanks, if the output
           string is shorter than field-width.
 
           If precision is specified, it specifies the number of
@@ -4117,7 +4119,10 @@ Transposing beyond buffer boundaries is an error.  */)
   int gap, len1, len_mid, len2;
   unsigned char *start1_addr, *start2_addr, *temp;
 
-  INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2;
+  INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3;
+  Lisp_Object buf;
+
+  XSETBUFFER (buf, current_buffer);
   cur_intv = BUF_INTERVALS (current_buffer);
 
   validate_region (&startr1, &endr1);
@@ -4224,8 +4229,11 @@ Transposing beyond buffer boundaries is an error.  */)
 
       tmp_interval1 = copy_intervals (cur_intv, start1, len1);
       tmp_interval2 = copy_intervals (cur_intv, start2, len2);
-      Fset_text_properties (make_number (start1), make_number (end2),
-                           Qnil, Qnil);
+      /* Don't use Fset_text_properties: that can cause GC, which can
+        clobber objects stored in the tmp_intervals.  */
+      tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
+      if (!NULL_INTERVAL_P (tmp_interval3))
+       set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
 
       /* First region smaller than second.  */
       if (len1_byte < len2_byte)
@@ -4281,10 +4289,14 @@ Transposing beyond buffer boundaries is an error.  */)
           record_change (start2, len2);
           tmp_interval1 = copy_intervals (cur_intv, start1, len1);
           tmp_interval2 = copy_intervals (cur_intv, start2, len2);
-          Fset_text_properties (make_number (start1), make_number (end1),
-                               Qnil, Qnil);
-          Fset_text_properties (make_number (start2), make_number (end2),
-                               Qnil, Qnil);
+
+         tmp_interval3 = validate_interval_range (buf, &startr1, &endr1, 0);
+         if (!NULL_INTERVAL_P (tmp_interval3))
+           set_text_properties_1 (startr1, endr1, Qnil, buf, tmp_interval3);
+
+         tmp_interval3 = validate_interval_range (buf, &startr2, &endr2, 0);
+         if (!NULL_INTERVAL_P (tmp_interval3))
+           set_text_properties_1 (startr2, endr2, Qnil, buf, tmp_interval3);
 
          SAFE_ALLOCA (temp, unsigned char *, len1_byte);
          start1_addr = BYTE_POS_ADDR (start1_byte);
@@ -4310,8 +4322,10 @@ Transposing beyond buffer boundaries is an error.  */)
           tmp_interval1 = copy_intervals (cur_intv, start1, len1);
           tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
           tmp_interval2 = copy_intervals (cur_intv, start2, len2);
-          Fset_text_properties (make_number (start1), make_number (end2),
-                               Qnil, Qnil);
+
+         tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
+         if (!NULL_INTERVAL_P (tmp_interval3))
+           set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
 
          /* holds region 2 */
          SAFE_ALLOCA (temp, unsigned char *, len2_byte);
@@ -4341,8 +4355,10 @@ Transposing beyond buffer boundaries is an error.  */)
           tmp_interval1 = copy_intervals (cur_intv, start1, len1);
           tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
           tmp_interval2 = copy_intervals (cur_intv, start2, len2);
-          Fset_text_properties (make_number (start1), make_number (end2),
-                               Qnil, Qnil);
+
+         tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
+         if (!NULL_INTERVAL_P (tmp_interval3))
+           set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
 
          /* holds region 1 */
          SAFE_ALLOCA (temp, unsigned char *, len1_byte);
@@ -4377,6 +4393,7 @@ Transposing beyond buffer boundaries is an error.  */)
       fix_start_end_in_overlays (start1, end2);
     }
 
+  signal_after_change (start1, end2 - start1, end2 - start1);
   return Qnil;
 }