From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83vcfc1jzr.fsf@gnu.org> References: <87has6ysxn.fsf@web.de> <834no4jeoa.fsf@gnu.org> <87ehmwscrt.fsf@web.de> <83ehmwh0pn.fsf@gnu.org> <87sjb9g981@ch.ristopher.com> <83oblrqwc1.fsf@gnu.org> <877gs218a3@ch.ristopher.com> <83ligikuam.fsf@gnu.org> <87mx0y9fss@ch.ristopher.com> <83d31tls6u.fsf@gnu.org> <87zk4xu6nf@ch.ristopher.com> <837gs1lnve.fsf@gnu.org> <87lig8efgk@ch.ristopher.com> <83wqzs1olw.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1347913142 27023 80.91.229.3 (17 Sep 2012 20:19:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Sep 2012 20:19:02 +0000 (UTC) Cc: 12196@debbugs.gnu.org To: christopher@ch.ristopher.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 17 22:19:05 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TDhmR-0000uT-Mh for geb-bug-gnu-emacs@m.gmane.org; Mon, 17 Sep 2012 22:18:55 +0200 Original-Received: from localhost ([::1]:43190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDhmN-0007qH-3K for geb-bug-gnu-emacs@m.gmane.org; Mon, 17 Sep 2012 16:18:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:32893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDhmJ-0007q1-UC for bug-gnu-emacs@gnu.org; Mon, 17 Sep 2012 16:18:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TDhmI-00034T-Ne for bug-gnu-emacs@gnu.org; Mon, 17 Sep 2012 16:18:47 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDhmI-00034O-Jw for bug-gnu-emacs@gnu.org; Mon, 17 Sep 2012 16:18:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TDhnV-0007Mn-Q2 for bug-gnu-emacs@gnu.org; Mon, 17 Sep 2012 16:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Sep 2012 20:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12196 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12196-submit@debbugs.gnu.org id=B12196.134791317828281 (code B ref 12196); Mon, 17 Sep 2012 20:20:01 +0000 Original-Received: (at 12196) by debbugs.gnu.org; 17 Sep 2012 20:19:38 +0000 Original-Received: from localhost ([127.0.0.1]:40355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDhn8-0007M6-FB for submit@debbugs.gnu.org; Mon, 17 Sep 2012 16:19:38 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:63928) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDhn5-0007Lx-9S for 12196@debbugs.gnu.org; Mon, 17 Sep 2012 16:19:37 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MAI00800G953300@a-mtaout23.012.net.il> for 12196@debbugs.gnu.org; Mon, 17 Sep 2012 23:18:08 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MAI008EJGE82W10@a-mtaout23.012.net.il>; Mon, 17 Sep 2012 23:18:08 +0300 (IDT) In-reply-to: <83wqzs1olw.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64530 Archived-At: > Date: Mon, 17 Sep 2012 21:38:35 +0300 > From: Eli Zaretskii > Cc: 12196@debbugs.gnu.org > > > From: Christopher Schmidt > > Cc: Eli Zaretskii > > 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 + * 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 . === 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);