emacs-devel
[Top][All Lists]
Advanced

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

Re: 22.1.50; insert-file-contents is slow under tramp


From: martin rudalics
Subject: Re: 22.1.50; insert-file-contents is slow under tramp
Date: Thu, 23 Aug 2007 16:25:32 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Using edebug I found the slowdown occurs when insert-file-contents is
called in find-file-noselect-1.  I don't know how to debug it further.
This slowdown did not exist in my previous Emacs build from 2007-06-30.

Stefan found a bug in my recent changes to `insert-file-contents'.
I can't tell whether it's related to your problem but could you try
with the attached patch?
*** fileio.c    Sat Aug 18 09:50:08 2007
--- fileio.c    Thu Aug 23 11:04:32 2007
***************
*** 4733,4746 ****
          int opoint = PT;
          int opoint_byte = PT_BYTE;
          int oinserted = ZV - BEGV;
          
          TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); 
          insval = call3 (Qformat_decode,
                          Qnil, make_number (oinserted), visit);
          CHECK_NUMBER (insval);
!         if (XINT (insval) == oinserted)
            SET_PT_BOTH (opoint, opoint_byte);
!         inserted = XFASTINT (insval);
        }
  
        /* For consistency with format-decode call these now iff inserted > 0
--- 4733,4753 ----
          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 (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);
        }
  
        /* For consistency with format-decode call these now iff inserted > 0
***************
*** 4763,4777 ****
              int opoint = PT;
              int opoint_byte = PT_BYTE;
              int oinserted = ZV - BEGV;
! 
              TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
              insval = call1 (XCAR (p), make_number (oinserted));
              if (!NILP (insval))
                {
                  CHECK_NUMBER (insval);
!                 if (XINT (insval) == oinserted)
                    SET_PT_BOTH (opoint, opoint_byte);
!                 inserted = XFASTINT (insval);
                }
            }
  
--- 4770,4793 ----
              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 (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]