emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/fileio.c,v


From: Martin Rudalics
Subject: [Emacs-diffs] Changes to emacs/src/fileio.c,v
Date: Fri, 24 Aug 2007 05:35:24 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Martin Rudalics <m061211>       07/08/24 05:35:24

Index: fileio.c
===================================================================
RCS file: /sources/emacs/emacs/src/fileio.c,v
retrieving revision 1.588
retrieving revision 1.589
diff -u -b -r1.588 -r1.589
--- fileio.c    13 Aug 2007 13:41:17 -0000      1.588
+++ fileio.c    24 Aug 2007 05:35:24 -0000      1.589
@@ -4733,13 +4733,20 @@
          int opoint = PT;
          int opoint_byte = PT_BYTE;
          int oinserted = ZV - BEGV;
+         int ochars_modiff = CHARS_MODIFF;
          
          TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); 
          insval = call3 (Qformat_decode,
                          Qnil, make_number (oinserted), visit);
          CHECK_NUMBER (insval);
-         if (XINT (insval) == oinserted)
+         if (ochars_modiff == CHARS_MODIFF)
+           /* format_decode didn't modify buffer's characters => move
+              point back to position before inserted text and leave
+              value of inserted alone. */
            SET_PT_BOTH (opoint, opoint_byte);
+         else
+           /* format_decode modified buffer's characters => consider
+              entire buffer changed and leave point at point-min. */
          inserted = XFASTINT (insval);
        }
 
@@ -4763,14 +4770,23 @@
              int opoint = PT;
              int opoint_byte = PT_BYTE;
              int oinserted = ZV - BEGV;
+             int ochars_modiff = CHARS_MODIFF;
 
              TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
              insval = call1 (XCAR (p), make_number (oinserted));
              if (!NILP (insval))
                {
                  CHECK_NUMBER (insval);
-                 if (XINT (insval) == oinserted)
+                 if (ochars_modiff == CHARS_MODIFF)
+                   /* after_insert_file_functions didn't modify
+                      buffer's characters => move point back to
+                      position before inserted text and leave value of
+                      inserted alone. */
                    SET_PT_BOTH (opoint, opoint_byte);
+                 else
+                   /* after_insert_file_functions did modify buffer's
+                      characters => consider entire buffer changed and
+                      leave point at point-min. */
                  inserted = XFASTINT (insval);
                }
            }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]