From: Eli Zaretskii <eliz@gnu.org>
To: christopher@ch.ristopher.com
Cc: 12196@debbugs.gnu.org
Subject: bug#12196: 24.1.50; setting cache-long-line-scans to non-nil freezes Emacs
Date: Mon, 17 Sep 2012 23:18:16 +0300 [thread overview]
Message-ID: <83vcfc1jzr.fsf@gnu.org> (raw)
In-Reply-To: <83wqzs1olw.fsf@gnu.org>
> Date: Mon, 17 Sep 2012 21:38:35 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 12196@debbugs.gnu.org
>
> > From: Christopher Schmidt <christopher@ch.ristopher.com>
> > Cc: Eli Zaretskii <eliz@gnu.org>
> > Date: Mon, 17 Sep 2012 18:17:48 +0100 (BST)
> >
> > emacs -q
> > M-: (setq-default cache-long-line-scans t) RET
> > M-: (setq gnus-select-method
> > '(nntp "news.gmane.org"
> > (nntp-open-connection-function nntp-open-tls-stream)
> > (nntp-port-number "nntps"))) RET
> > M-x gnus RET
> > ^
> > # Move point to "{nntp:news.gmane.org} (opened)"
> > RET
> > # Move point to "K XXXXX: gmane.emacs.bugs"
> > RET RET
>
> OK, I succeeded in reproducing this on one of the systems where I can
> debug it, thanks.
Should be fixed in trunk revision 110079, the patch is below for your
convenience. Please test.
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2012-09-17 07:56:20 +0000
+++ src/ChangeLog 2012-09-17 20:11:34 +0000
@@ -1,5 +1,9 @@
2012-09-17 Eli Zaretskii <eliz@gnu.org>
+ * search.c (scan_buffer): Use character positions in calls to
+ region_cache_forward and region_cache_backward, not byte
+ positions. (Bug#12196)
+
* w32term.c (w32_read_socket): Set pending_signals to 1, like
xterm.c does. Reported by Daniel Colascione <dancol@dancol.org>.
=== modified file 'src/search.c'
--- src/search.c 2012-09-15 07:06:56 +0000
+++ src/search.c 2012-09-17 20:11:34 +0000
@@ -674,7 +674,7 @@ scan_buffer (register int target, ptrdif
obstacle --- the last character the dumb search loop should
examine. */
ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end) - 1;
- ptrdiff_t start_byte = CHAR_TO_BYTE (start);
+ ptrdiff_t start_byte;
ptrdiff_t tem;
/* If we're looking for a newline, consult the newline cache
@@ -684,18 +684,22 @@ scan_buffer (register int target, ptrdif
ptrdiff_t next_change;
immediate_quit = 0;
while (region_cache_forward
- (current_buffer, newline_cache, start_byte, &next_change))
- start_byte = next_change;
+ (current_buffer, newline_cache, start, &next_change))
+ start = next_change;
immediate_quit = allow_quit;
+ start_byte = CHAR_TO_BYTE (start);
+
/* START should never be after END. */
if (start_byte > ceiling_byte)
start_byte = ceiling_byte;
/* Now the text after start is an unknown region, and
next_change is the position of the next known region. */
- ceiling_byte = min (next_change - 1, ceiling_byte);
+ ceiling_byte = min (CHAR_TO_BYTE (next_change) - 1, ceiling_byte);
}
+ else
+ start_byte = CHAR_TO_BYTE (start);
/* The dumb loop can only scan text stored in contiguous
bytes. BUFFER_CEILING_OF returns the last character
@@ -747,7 +751,7 @@ scan_buffer (register int target, ptrdif
{
/* The last character to check before the next obstacle. */
ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end);
- ptrdiff_t start_byte = CHAR_TO_BYTE (start);
+ ptrdiff_t start_byte;
ptrdiff_t tem;
/* Consult the newline cache, if appropriate. */
@@ -756,18 +760,22 @@ scan_buffer (register int target, ptrdif
ptrdiff_t next_change;
immediate_quit = 0;
while (region_cache_backward
- (current_buffer, newline_cache, start_byte, &next_change))
- start_byte = next_change;
+ (current_buffer, newline_cache, start, &next_change))
+ start = next_change;
immediate_quit = allow_quit;
+ start_byte = CHAR_TO_BYTE (start);
+
/* Start should never be at or before end. */
if (start_byte <= ceiling_byte)
start_byte = ceiling_byte + 1;
/* Now the text before start is an unknown region, and
next_change is the position of the next known region. */
- ceiling_byte = max (next_change, ceiling_byte);
+ ceiling_byte = max (CHAR_TO_BYTE (next_change), ceiling_byte);
}
+ else
+ start_byte = CHAR_TO_BYTE (start);
/* Stop scanning before the gap. */
tem = BUFFER_FLOOR_OF (start_byte - 1);
next prev parent reply other threads:[~2012-09-17 20:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 4:54 bug#12196: 24.1.50; setting cache-long-line-scans to non-nil freezes Emacs Michael Heerdegen
2012-08-15 16:36 ` Eli Zaretskii
2012-08-24 12:19 ` Michael Heerdegen
2012-08-24 13:35 ` Eli Zaretskii
2012-08-26 11:53 ` Christopher Schmidt
2012-08-31 8:50 ` Eli Zaretskii
2012-09-10 10:28 ` Christopher Schmidt
2012-09-10 11:10 ` Eli Zaretskii
2012-09-10 13:19 ` Christopher Schmidt
2012-09-10 17:10 ` Eli Zaretskii
2012-09-10 17:31 ` Christopher Schmidt
2012-09-10 18:43 ` Eli Zaretskii
2012-09-17 17:17 ` Christopher Schmidt
2012-09-17 18:38 ` Eli Zaretskii
2012-09-17 18:53 ` Christopher Schmidt
2012-09-17 20:18 ` Eli Zaretskii [this message]
2012-09-18 7:25 ` Christopher Schmidt
2012-09-18 8:02 ` Eli Zaretskii
2012-08-26 15:58 ` Michael Heerdegen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83vcfc1jzr.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=12196@debbugs.gnu.org \
--cc=christopher@ch.ristopher.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).