[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug of auto saving
From: |
Kenichi Handa |
Subject: |
bug of auto saving |
Date: |
Tue, 10 Jun 2003 16:03:17 +0900 (JST) |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) |
It seems that my recent change as to auto saving revealed an
old bug.
Currently Fwrite_region has this code.
/* Special kludge to simplify auto-saving. */
if (NILP (start))
{
XSETFASTINT (start, BEG);
XSETFASTINT (end, Z);
}
And we later calls annotations and per-write-conversion as this:
res = call2 (XCAR (p), start, end);
or
res = call2 (pre_write_conversion, start, end);
But, it doesn't pay attention to the case that a buffer is
narrowed. In such a case, when the called Lisp functions
try to access the buffer region between START and END, an
error happens.
I think the attached change fixes this bug. I'll install it
after testing it for a while.
---
Ken'ichi HANDA
address@hidden
2003-06-10 Kenichi Handa <address@hidden>
* fileio.c (build_annotations_unwind): Arg changed. Restore
narrowing if any.
(Fwrite_region): For auto-saving, widen the buffer.
*** fileio.c.~1.487.~ Sat May 31 10:52:35 2003
--- fileio.c Tue Jun 10 15:44:38 2003
***************
*** 4659,4674 ****
-- K.Handa */
static Lisp_Object
! build_annotations_unwind (buf)
! Lisp_Object buf;
{
Lisp_Object tembuf;
! if (XBUFFER (buf) == current_buffer)
! return Qnil;
! tembuf = Fcurrent_buffer ();
! Fset_buffer (buf);
! Fkill_buffer (tembuf);
return Qnil;
}
--- 4659,4680 ----
-- K.Handa */
static Lisp_Object
! build_annotations_unwind (buf_and_region)
! Lisp_Object buf_and_region;
{
+ Lisp_Object buf = XCAR (buf_and_region);
+ Lisp_Object begv_pos = XCAR (XCDR (buf_and_region));
+ Lisp_Object zv_pos = XCAR (XCDR (XCDR (buf_and_region)));
Lisp_Object tembuf;
! if (XBUFFER (buf) != current_buffer)
! {
! tembuf = Fcurrent_buffer ();
! Fset_buffer (buf);
! Fkill_buffer (tembuf);
! }
! if (XINT (begv_pos) > BEG || XINT (zv_pos) < Z)
! Fnarrow_to_region (begv_pos, zv_pos);
return Qnil;
}
***************
*** 4892,4905 ****
return val;
}
/* Special kludge to simplify auto-saving. */
if (NILP (start))
{
XSETFASTINT (start, BEG);
XSETFASTINT (end, Z);
}
- record_unwind_protect (build_annotations_unwind, Fcurrent_buffer ());
count1 = SPECPDL_INDEX ();
given_buffer = current_buffer;
--- 4898,4914 ----
return val;
}
+ record_unwind_protect (build_annotations_unwind,
+ list3 (Fcurrent_buffer (),
+ make_number (BEGV), make_number (ZV)));
/* Special kludge to simplify auto-saving. */
if (NILP (start))
{
XSETFASTINT (start, BEG);
XSETFASTINT (end, Z);
+ Fwiden ();
}
count1 = SPECPDL_INDEX ();
given_buffer = current_buffer;
- bug of auto saving,
Kenichi Handa <=