From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw. Date: Sat, 16 Dec 2006 23:43:34 +0100 Message-ID: <45847696.7020000@gmx.at> References: <45768797.5010106@gmx.at> <87odqhj89q.fsf@stupidchicken.com> <20061210014526.GB3738@muc.de> <877ix0lfm8.fsf@furball.mit.edu> <20061210102249.GA1235@muc.de> <87d56rpk7a.fsf@stupidchicken.com> <20061213224009.GA1206@muc.de> <87odq72ssy.fsf@stupidchicken.com> <20061214084713.GA1333@muc.de> <45812BDF.5050107@gmx.at> <4583C7D3.1070703@gmx.at> <45843AA5.5080906@gmx.at> <45844243.4060706@gmx.at> <87hcvvzlco.fsf@stupidchicken.com> <4584500B.7020303@gmx.at> <87d56jzjn3.fsf@stupidchicken.com> <8764cbzg5e.fsf@stupidchicken.com> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1166309068 4219 80.91.229.10 (16 Dec 2006 22:44:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 16 Dec 2006 22:44:28 +0000 (UTC) Cc: Alan Mackenzie , Stefan Monnier , Richard Stallman , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 16 23:44:24 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GviGQ-0005nz-S1 for ged-emacs-devel@m.gmane.org; Sat, 16 Dec 2006 23:44:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GviGQ-0004gV-FM for ged-emacs-devel@m.gmane.org; Sat, 16 Dec 2006 17:44:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GviFr-0004LA-UJ for emacs-devel@gnu.org; Sat, 16 Dec 2006 17:43:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GviFr-0004K4-7M for emacs-devel@gnu.org; Sat, 16 Dec 2006 17:43:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GviFq-0004JX-T9 for emacs-devel@gnu.org; Sat, 16 Dec 2006 17:43:43 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.52) id 1GviFq-0007su-8O for emacs-devel@gnu.org; Sat, 16 Dec 2006 17:43:42 -0500 Original-Received: (qmail invoked by alias); 16 Dec 2006 22:43:40 -0000 Original-Received: from N705P013.adsl.highway.telekom.at (EHLO [62.47.32.13]) [62.47.32.13] by mail.gmx.net (mp007) with SMTP; 16 Dec 2006 23:43:40 +0100 X-Authenticated: #14592706 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en Original-To: Chong Yidong In-Reply-To: <8764cbzg5e.fsf@stupidchicken.com> X-Y-GMX-Trusted: 0 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:63857 Archived-At: > This idea seems to work fairly well. The patch to syntax.c is > attached; it adds an optional DEFUN_START argument to scan_lists which > is a position known to be outside any code structure. The code in > beginning-of-defun-raw can be altered to use this as follows: > > (let* ((ppss (let (syntax-begin-function > font-lock-beginning-of-syntax-function) > (syntax-ppss))) > (defun-start (nth 2 ppss)) > ...) > ... > (goto-char (scan-lists (point) (- arg) 0 defun-start)) > > With this additional change, (progn (goto-char (point-max)) (redisplay)) > on xdisp.c takes 0.139s, down from 2.15s. This seems to prove that we have localized the bug. The problem is, however, that scan-lists is probably used in too many places and you would reliably have to find the defun-start for each and every of them. > However M-> is still slow, because, for some reason, (recenter -3) at > the end of the buffer now takes about 2 seconds. I don't know why. Probably because somewhere scan-lists is called without the appropriate defun-start. > However, I think all this should be post-22 work; for Emacs 22, let's > just set open-paren-in-column-0-is-defun-start to t, and leave the > existing beginning-of-defun-raw code there should anyone want to set > it to nil. I agree. More so, because, as I stated earlier, editing C code on my system has become painstakingly slow for more than a year. The recent change to `beginning-of-defun-raw' was apparently just the straw breaking the camel's back.