From: Kenichi Handa <handa@m17n.org>
Subject: bug of auto saving
Date: Tue, 10 Jun 2003 16:03:17 +0900 (JST) [thread overview]
Message-ID: <200306100703.QAA10770@etlken.m17n.org> (raw)
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
handa@m17n.org
2003-06-10 Kenichi Handa <handa@m17n.org>
* 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;
next reply other threads:[~2003-06-10 7:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-10 7:03 Kenichi Handa [this message]
2003-06-11 0:25 ` bug of auto saving Richard Stallman
2003-06-11 1:05 ` Kenichi Handa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200306100703.QAA10770@etlken.m17n.org \
--to=handa@m17n.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.