From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: /srv/bzr/emacs/trunk r101338: * lisp/emacs-lisp/syntax.el (syntax-ppss): More sanity check to catch Date: Fri, 14 Feb 2014 17:08:11 +0200 Message-ID: <52FE315B.5010909@yandex.ru> References: <87r47bi1e5.fsf@yandex.ru> <52F96284.50507@yandex.ru> <52FAE12B.6060101@yandex.ru> <52FC3BEE.60604@yandex.ru> <52FCD2B4.5080006@yandex.ru> <52FD9F1D.50205@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1392390511 3721 80.91.229.3 (14 Feb 2014 15:08:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Feb 2014 15:08:31 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 14 16:08:39 2014 Return-path: Envelope-to: ged-emacs-devel@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 1WEKNb-0006y3-1V for ged-emacs-devel@m.gmane.org; Fri, 14 Feb 2014 16:08:39 +0100 Original-Received: from localhost ([::1]:52240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEKNa-0004dy-IS for ged-emacs-devel@m.gmane.org; Fri, 14 Feb 2014 10:08:38 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEKNO-0004T8-Hj for emacs-devel@gnu.org; Fri, 14 Feb 2014 10:08:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WEKNG-0008H4-2l for emacs-devel@gnu.org; Fri, 14 Feb 2014 10:08:26 -0500 Original-Received: from mail-ee0-x236.google.com ([2a00:1450:4013:c00::236]:48108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEKNF-0008Gk-EW for emacs-devel@gnu.org; Fri, 14 Feb 2014 10:08:18 -0500 Original-Received: by mail-ee0-f54.google.com with SMTP id e53so5749295eek.27 for ; Fri, 14 Feb 2014 07:08:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=w2fqUHiPZdwGf4VIRh+vxii3aAPtD6AUCmcSUOunkkg=; b=kxwAxk6MMDlYV1iHdCcUAFEcHBw1IIq+hHFxoC849cY9DL6j09CgqKfgevtMYLz7u1 aYjUJRZe254yOb1ihnkUe1B/pn2ywJ0jP1mQi1gVoypGWMEcuJETUC6feaIa7xl0VLBN ikatCHAJTyiwzwhtqybtoRb90XO0wAAkvPTocuusfVGvuM4P5LOywhvso7pVM9eB+ZMK Gh75WeDN34XT1reFgIjPVHdbYkkS06wZCowaoLINrKShuQzAOPdqndhJpyYkwOacOupi nvpchXya9DfcwqFqbi+zhzP5uhiEh0n+djSHdWMe1+TH714GlHFbw4e+MOammNs03etx 9+1A== X-Received: by 10.15.36.70 with SMTP id h46mr77779eev.96.1392390496445; Fri, 14 Feb 2014 07:08:16 -0800 (PST) Original-Received: from [192.168.0.94] (static-nbl2-118.cytanet.com.cy. [212.31.107.118]) by mx.google.com with ESMTPSA id k41sm20774523een.19.2014.02.14.07.08.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Feb 2014 07:08:15 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:169613 Archived-At: On 14.02.2014 16:23, Stefan Monnier wrote: > It does iterate over the whole list, yes. It ignores most elements, tho. Hmm. Not looking at the C code, I figured access to buffer-local variables happens through the buffer structure, each time they're looked up or modified. Maybe this way is faster. >>> Hmm... I wonder why mmm-save-local-variables is defined the way it is. >>> It doesn't seem to make use of `buffer-local-variables', even though it's >>> the most natural starting point. E.g. there shouldn't be a need to list >>> explicitly all the c-* variables. Maybe the author didn't know about >>> buffer-local-variables (or it didn't exist back then)? >> I'm not quite sure, but this way we only save the variables that are known >> to be safe in the multiple-mode context. > > The way I see it, it's rather "this way we can only work for those major > modes we've been taught to handle". Yes and no. An mmm-mode aware package can modify `mmm-save-local-variables', too. > I'm really interested in adding something like mmm-mode (or mumamo or > web-mode) into Emacs. Last time I checked, web-mode wasn't in this category: it's a major mode with explicit support for some templating languages. mumamo is an unsupported mess (sorry, Lennart). mmm-mode would require a hunt for CA signatures, but it's not outside the realm of possibility. multi-mode would be the most likely option, I believe (it's already copyright-assigned), but it'll either require major changes, or indirect buffers would have to be "fixed", which is not likely, judging by this conversation. > It'll have to start in GNU ELPA, I think, but in > any case before it can make it into Emacs it will have to be structured > such that new major modes can be handled without having to modify > mmm-mode. I think you mean "can be handled without them being explicitly aware of mmm-mode", because modifying `mmm-save-local-variables' works from outside, too. >> And also don't touch anything mmm-mode itself introduced. > > This is the list that we can trivially know, so it's OK if we have to > handle these specially. I haven't measured it, but wouldn't adding an (unless (memq var (list with 20 elements))) around processing each variable be, like, slow? > BTW, I really don't know yet what will work best. Maybe the > "save&restore only those vars we've been told" as is currently done is > indeed the best option. But in that case it shouldn't be done via > a variable listing those symbols, but e.g. by adding a special > property to those symbols. A special property would be neater, I guess. But then we'll really have to go though `buffer-local-variables'. >> Now that I've checked, parsing the buffer into regions is definitely the >> slowest part (followed by fontification, which takes about 40% of the time >> in the current test example): > > Does mmm-mode parse the buffer lazily? Nope (unlike mumamo and, sorta, multi-mode). I guess it would be the next major feature to implement there. Originally the parsing was triggered only manually. I added an idle timer, but it's still a kludge. > Is fontification done "the jit-lock way"? Most of the time yes, but "reparsing" the buffer triggers the full refontification. There are no hard reasons why it can't be fixed, though.