From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: forward-comment and syntax-ppss Date: Tue, 20 Dec 2016 08:33:40 -0500 Message-ID: References: <20161207220447.GA4503@acm.fritz.box> <20161208201517.GB3120@acm.fritz.box> <20161209190747.GC2203@acm.fritz.box> <5a70902f-882e-f616-74b2-df6eb81fc70c@yandex.ru> <20161211101715.GA14084@acm.fritz.box> <51c0554f-40d0-37a5-b134-17058343aa3f@yandex.ru> <20161216200630.GB3858@acm.fritz.box> <83r3576lxs.fsf@gnu.org> <838tre7gqt.fsf@gnu.org> <9e3a5f1b-2bd6-4223-bcb0-790be47d52ab@yandex.ru> <58afc3fb-a191-40c5-a6e9-8666f3e9ee21@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1482244438 16164 195.159.176.226 (20 Dec 2016 14:33:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Dec 2016 14:33:58 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 20 15:33:53 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJLUH-0003EL-FR for ged-emacs-devel@m.gmane.org; Tue, 20 Dec 2016 15:33:53 +0100 Original-Received: from localhost ([::1]:51654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJLUL-0006OG-PC for ged-emacs-devel@m.gmane.org; Tue, 20 Dec 2016 09:33:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJLUC-0006Mw-Hy for emacs-devel@gnu.org; Tue, 20 Dec 2016 09:33:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cJLU7-0004iN-J2 for emacs-devel@gnu.org; Tue, 20 Dec 2016 09:33:48 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:43040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJLU7-0004hu-Ep for emacs-devel@gnu.org; Tue, 20 Dec 2016 09:33:43 -0500 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id uBKEXdUl024843; Tue, 20 Dec 2016 09:33:39 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 945216626E; Tue, 20 Dec 2016 08:33:40 -0500 (EST) In-Reply-To: (Dmitry Gutov's message of "Tue, 20 Dec 2016 01:16:37 +0200") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV5894=0 X-NAI-Spam-Version: 2.3.0.9418 : core <5894> : inlines <5587> : streams <1725479> : uri <2343948> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:210659 Archived-At: > It can track the value of point-min, but it won't really know what to do > with the caches corresponding to the previous point-min values. I'd expect they'd get flushed by syntax-ppss-flush-cache. But I don't really see why you think there's a problem to solve there. I assume syntax-ppss would usually "widen to syntax-start-pos" or somesuch, so there should not be many different point-mins indexed there. >> - we could/should have a macro (with-new-syntax-ppss-context >> ... &rest BODY) which runs BODY such that calls to syntax-ppss in >> there can be cached within this scope but don't use the outer >> syntax-ppss cache and don't affect it. This could be used when >> a command wants to temporarily use an ad-hoc syntax-table (typically >> using with-syntax-table), for example. It should probably be made to >> obey the current narrowing limits, since such uses often additionally >> want to restrict the parsing to a subpart of the buffer. > That seems sound. And, basically, all that's necessary for mixed-mode > packages to work. But the multi-mode case would additionally want to preserve the "inner cache" across uses of with-new-syntax-ppss-context. >> - if we introduce a syntax-ppss-parse-start, it should not have `ppss` >> in its name, it should probably try to include some of the design of >> indentation-context, > Which ones? Having both lower and upper bound? My memory is too fuzzy about that to have a clear opinion. > It's not indentation specific, so using the name is out of the > question, I think. I wasn't thinking about re-using the name, no. >> This said, if needed it'd probably be OK to have syntax-ppss >> auto-detect changes instead (after all, syntax-ppss is still >> implemented in Elisp, so there is a lot of room for speed up). > It might not we the fastest, but I'd like it to be algorithmically sound. Detecting changes is algorithmically cheap. >> I wouldn't do it in indent-for-tab-command, but I agree that it should >> be done in indent-according-to-mode rather than forcing every major >> mode's indentation function to widen. > Shouldn't indent-for-tab-command call indent-according-to-mode, then? Doesn't it? Oh wait, it technically doesn't because it wants to handle the `no-indent` return value of `indent-line-function` differently. But conceptually, I still consider it a call to indent-according-to-mode ;-) > Yes, and also agree about a similar rule for font-lock-keywords. That's already the case, no? > I really meant widen, though. Not sure what calling prog-widen in there > would mean, semantically, because according to the previous discussion > prog-narrowing was something a mixed-mode code would institute. But it's > down the call stack from indent-according-to-mode (via a mixed-mode aware > indent-line-function), not above it. Indeed, but I meant "somewhere between a call to indent-according-to-mode and the call to major-mode specific indent-line-function". The point is that the indent-line-function should not need to widen, although maybe the buffer is not fully widened (depending on whether the multi-mode system uses narrowing, maybe). Stefan