From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: ntemacs hangs when openning the attached file Date: Sat, 24 May 2008 13:16:36 +0000 Message-ID: <20080524131636.GA3025@muc.de> References: <42b562540805062101s3e79eecel5ddc5b19821deda2@mail.gmail.com> <20080523210123.GB4046@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1211633793 21645 80.91.229.12 (24 May 2008 12:56:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 24 May 2008 12:56:33 +0000 (UTC) Cc: Eli Zaretskii , yu jie , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 24 14:57:13 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JztJB-00047p-8o for ged-emacs-devel@m.gmane.org; Sat, 24 May 2008 14:57:13 +0200 Original-Received: from localhost ([127.0.0.1]:46635 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JztIQ-0003hJ-Ia for ged-emacs-devel@m.gmane.org; Sat, 24 May 2008 08:56:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JztIM-0003g9-B6 for emacs-devel@gnu.org; Sat, 24 May 2008 08:56:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JztIL-0003fN-Ne for emacs-devel@gnu.org; Sat, 24 May 2008 08:56:22 -0400 Original-Received: from [199.232.76.173] (port=36488 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JztIL-0003fH-K1 for emacs-devel@gnu.org; Sat, 24 May 2008 08:56:21 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:4157 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JztIL-0007NW-Bv for emacs-devel@gnu.org; Sat, 24 May 2008 08:56:21 -0400 Original-Received: (qmail 93422 invoked by uid 3782); 24 May 2008 12:56:17 -0000 Original-Received: from acm.muc.de (pD9E53245.dip.t-dialin.net [217.229.50.69]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sat, 24 May 2008 14:56:11 +0200 Original-Received: (qmail 7304 invoked by uid 1000); 24 May 2008 13:16:37 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 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:97644 Archived-At: Hi, Stefan! On Fri, May 23, 2008 at 05:36:34PM -0400, Stefan Monnier wrote: > > The problem was that c-neutralize-syntax-in-CPP was inefficiently > > coded. I've optimised it using essentially only Emacs primitives in > > the defun's main loop. It now runs almost 2 orders of magnitude > > faster. > Sounds good. > > Eli, I'd appreciate it very much indeed if you could review this new > > code, please - earlier versions of it were peculiarly troublesome. > Don't know about Eli. That's OK. You'll do instead. ;-) (Thanks!) > But here's some comments: > > + ;; Note: SPEED _MATTERS_ IN THIS FUNCTION!!! > > + ;; > > ;; This function might do invisible changes. > ^^ > make I hereby resign from my role as project linguistic pedant. ;-) That one (and ~100 others) have been in the source for ~5 years, put there by Martin. How could I miss this?? > > + (setq pps-position beg pps-state nil) > It would be a lot more lispy to explicitly let-bind pps-position and > pps-state here, rather than declare them earlier without initializing > them and then initializing them here. I'd thought that that would just be an unnecessary extra `let'. However, having tried it, it does make the code a bit clearer. So yes, thank you - I'll be doing this more in the future. > > (while (and (< (point) end) > > (search-forward-regexp c-anchored-cpp-prefix end t)) > > ;; If we've found a "#" inside a string/comment, ignore it. > > ! (setq pps-state > > ! (parse-partial-sexp pps-position (point) nil nil pps-state) > > ! pps-position (point)) > > ! (unless (or (nth 3 pps-state) ; in a string? > > ! (nth 4 pps-state)) ; in a comment? > > (setq mbeg+1 (point)) > > (c-end-of-macro) ; Do we need to go forward 1 char here? No! > > ! (c-neutralize-CPP-line mbeg+1 (point)) > > ! (setq pps-state > > ! (parse-partial-sexp pps-position (point) nil nil pps-state) > > ! pps-position (point)))))) > I have the impression that this second call to parse-partial-sexp is > unnecessary. DUH!!! Of course! Wake up, Alan! That's the whole point of the call to `c-neutralize-CPP-line', just above. Thanks! > Stefan -- Alan Mackenzie (Nuremberg, Germany).