From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#16526: 24.3.50; scroll-conservatively & c-mode regression Date: Thu, 03 Jul 2014 10:59:58 -0400 Message-ID: References: <20140628145509.GB4144@acm.acm> <53AFD1FA.5010201@gmx.at> <20140629091757.GA2948@acm.acm> <53AFE536.7010407@gmx.at> <20140629124829.GC2948@acm.acm> <53B02042.1050107@gmx.at> <20140629144151.GD2948@acm.acm> <53B03876.9070307@gmx.at> <20140629174953.GE2948@acm.acm> <53B117D6.1050306@gmx.at> <20140702200522.GB3823@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT X-Trace: ger.gmane.org 1404399707 3719 80.91.229.3 (3 Jul 2014 15:01:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Jul 2014 15:01:47 +0000 (UTC) Cc: 16526@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 03 17:01:39 2014 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 1X2iW1-0007NY-DU for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Jul 2014 17:01:37 +0200 Original-Received: from localhost ([::1]:60214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2iW1-0007ts-0V for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Jul 2014 11:01:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2iVp-0007sT-Kj for bug-gnu-emacs@gnu.org; Thu, 03 Jul 2014 11:01:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2iVh-0002kX-6v for bug-gnu-emacs@gnu.org; Thu, 03 Jul 2014 11:01:25 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2iVS-0002hr-NE; Thu, 03 Jul 2014 11:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X2iVS-0003vJ-4A; Thu, 03 Jul 2014 11:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 03 Jul 2014 15:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16526 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 16526-submit@debbugs.gnu.org id=B16526.140439961214952 (code B ref 16526); Thu, 03 Jul 2014 15:01:02 +0000 Original-Received: (at 16526) by debbugs.gnu.org; 3 Jul 2014 15:00:12 +0000 Original-Received: from localhost ([127.0.0.1]:41787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X2iUZ-0003sb-8K for submit@debbugs.gnu.org; Thu, 03 Jul 2014 11:00:12 -0400 Original-Received: from relais.videotron.ca ([24.201.245.36]:60958) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X2iUR-0003rW-76 for 16526@debbugs.gnu.org; Thu, 03 Jul 2014 11:00:04 -0400 Original-Received: from ceviche.home ([24.201.170.218]) by VL-VM-MR002.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0N85009DK5NXNXBZ@VL-VM-MR002.ip.videotron.ca> for 16526@debbugs.gnu.org; Thu, 03 Jul 2014 10:59:57 -0400 (EDT) Original-Received: by ceviche.home (Postfix, from userid 20848) id 83393660FA; Thu, 03 Jul 2014 10:59:58 -0400 (EDT) In-reply-to: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:91143 Archived-At: Hi Alan, Can you try the patch below (for the emacs-24 branch), which tries to make the existing cache in find_defun_start do something useful in the case where find_defun_start returns BEGV? Stefan === modified file 'src/syntax.c' --- src/syntax.c 2014-02-08 05:12:47 +0000 +++ src/syntax.c 2014-07-03 14:57:04 +0000 @@ -530,17 +530,6 @@ { ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; - if (!open_paren_in_column_0_is_defun_start) - { - find_start_value = BEGV; - find_start_value_byte = BEGV_BYTE; - find_start_buffer = current_buffer; - find_start_modiff = MODIFF; - find_start_begv = BEGV; - find_start_pos = pos; - return BEGV; - } - /* Use previous finding, if it's valid and applies to this inquiry. */ if (current_buffer == find_start_buffer /* Reuse the defun-start even if POS is a little farther on. @@ -552,6 +541,13 @@ && MODIFF == find_start_modiff) return find_start_value; + if (!open_paren_in_column_0_is_defun_start) + { + find_start_value = BEGV; + find_start_value_byte = BEGV_BYTE; + goto found; + } + /* Back up to start of line. */ scan_newline (pos, pos_byte, BEGV, BEGV_BYTE, -1, 1); @@ -582,13 +578,14 @@ /* Record what we found, for the next try. */ find_start_value = PT; find_start_value_byte = PT_BYTE; + TEMP_SET_PT_BOTH (opoint, opoint_byte); + + found: find_start_buffer = current_buffer; find_start_modiff = MODIFF; find_start_begv = BEGV; find_start_pos = pos; - TEMP_SET_PT_BOTH (opoint, opoint_byte); - return find_start_value; } @@ -841,6 +838,7 @@ else { struct lisp_parse_state state; + bool adjusted = false; lossage: /* We had two kinds of string delimiters mixed up together. Decode this going forwards. @@ -852,6 +850,8 @@ { defun_start = find_defun_start (comment_end, comment_end_byte); defun_start_byte = find_start_value_byte; + if (defun_start != BEGV) + adjusted = true; } do { @@ -860,6 +860,16 @@ comment_end, TYPE_MINIMUM (EMACS_INT), 0, Qnil, 0); defun_start = comment_end; + if (!adjusted) + { + adjusted = true; + find_start_value + = CONSP (state.levelstarts) ? XINT (XCAR (state.levelstarts)) + : state.thislevelstart >= 0 ? state.thislevelstart + : find_start_value; + find_start_value_byte = CHAR_TO_BYTE (find_start_value); + } + if (state.incomment == (comnested ? 1 : -1) && state.comstyle == comstyle) from = state.comstr_start;