From: Dmitry Antipov <dmantipov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 12426@debbugs.gnu.org
Subject: bug#12426: 24.2.50; Emacs is closed unexpectedly after query-replace
Date: Thu, 13 Sep 2012 07:01:48 +0400 [thread overview]
Message-ID: <50514C9C.8010004@yandex.ru> (raw)
In-Reply-To: <83627jvzd8.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1453 bytes --]
On 09/12/2012 11:02 PM, Eli Zaretskii wrote:
> The reason for the assertion violation is the assertion in
> marker_position:
>
> eassert (BUF_BEG (buf) <= m->charpos && m->charpos <= BUF_Z (buf));
>
> This was introduced recently by Dmitry, in revision 108906. A similar
> assertion was added to marker_byte_position.
>
> Dmitry, why did you add them? Who said that a marker cannot
> legitimately have a position outside of its buffer's range of
> character positions?
IIUC marker can have out-of-buffer-range position, but only somewhere in the
middle of an insertion/deletion/replace operation; out-of-range position should
be detected and immediately fixed by adjust_markers_for_{delete,insert,replace}.
BTW, look at this code from replace_range:
/* Adjust the overlay center as needed. This must be done after
adjusting the markers that bound the overlays. */
adjust_overlays_for_delete (from, nchars_del);
adjust_overlays_for_insert (from, inschars);
/* Adjust markers for the deletion and the insertion. */
if (markers)
adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
inschars, outgoing_insbytes);
The comment explicitly says that overlays should be adjusted _after_ markers,
but the code adjusts overlays and then markers :-(. Since an overlays are
bounded by markers, the comment looks correct but the code isn't. I suppose
that the code snippets above should be swapped.
Dmitry
[-- Attachment #2: adjust.patch --]
[-- Type: text/plain, Size: 955 bytes --]
=== modified file 'src/insdel.c'
--- src/insdel.c 2012-09-11 04:22:03 +0000
+++ src/insdel.c 2012-09-13 02:47:36 +0000
@@ -1394,16 +1394,16 @@
eassert (GPT <= GPT_BYTE);
- /* Adjust the overlay center as needed. This must be done after
- adjusting the markers that bound the overlays. */
- adjust_overlays_for_delete (from, nchars_del);
- adjust_overlays_for_insert (from, inschars);
-
/* Adjust markers for the deletion and the insertion. */
if (markers)
adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
inschars, outgoing_insbytes);
+ /* Adjust the overlay center as needed. This must be done after
+ adjusting the markers that bound the overlays. */
+ adjust_overlays_for_delete (from, nchars_del);
+ adjust_overlays_for_insert (from, inschars);
+
offset_intervals (current_buffer, from, inschars - nchars_del);
/* Get the intervals for the part of the string we are inserting--
next prev parent reply other threads:[~2012-09-13 3:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 18:06 bug#12426: 24.2.50; Emacs is closed unexpectedly after query-replace Dani Moncayo
2012-09-12 18:39 ` Eli Zaretskii
2012-09-12 19:02 ` Eli Zaretskii
2012-09-13 3:01 ` Dmitry Antipov [this message]
2012-09-13 16:47 ` Eli Zaretskii
2012-09-14 12:35 ` Dmitry Antipov
2012-09-14 13:40 ` Eli Zaretskii
2012-09-17 17:51 ` Dani Moncayo
2012-09-12 19:15 ` Eli Zaretskii
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=50514C9C.8010004@yandex.ru \
--to=dmantipov@yandex.ru \
--cc=12426@debbugs.gnu.org \
--cc=eliz@gnu.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.