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: font-lock-syntactic-keywords obsolet? Date: Tue, 21 Jun 2016 19:28:03 +0300 Message-ID: <31343289-614b-a4f3-17d8-fab00819a2c9@yandex.ru> References: <20160619153455.GG5875@acm.fritz.box> <11c988f0-94c0-40dd-b9cd-5a5e27028b63@yandex.ru> <20160619171531.GH5875@acm.fritz.box> <751427e7-f305-7790-99f5-dea230d8e6c4@yandex.ru> <20160620105850.GB3166@acm.fritz.box> <23d7473e-50da-b6dc-17a7-1fec4aad6bfa@yandex.ru> <20160620152535.GB2192@acm.fritz.box> <076b7311-ad16-4913-b0ec-fc73ea4550a1@yandex.ru> <6e028101-2f0f-28c8-2762-14fa91087fcc@yandex.ru> <20160621152653.GC3177@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1466526543 19984 80.91.229.3 (21 Jun 2016 16:29:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jun 2016 16:29:03 +0000 (UTC) Cc: emacs-devel@gnu.org, Noam Postavsky To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 21 18:28:57 2016 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 1bFOXl-0002OC-TF for ged-emacs-devel@m.gmane.org; Tue, 21 Jun 2016 18:28:54 +0200 Original-Received: from localhost ([::1]:52950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFOXk-0000Qu-Vy for ged-emacs-devel@m.gmane.org; Tue, 21 Jun 2016 12:28:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFOX7-0000Pq-0d for emacs-devel@gnu.org; Tue, 21 Jun 2016 12:28:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFOX1-0003i5-I1 for emacs-devel@gnu.org; Tue, 21 Jun 2016 12:28:11 -0400 Original-Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]:35503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFOX1-0003hy-8w for emacs-devel@gnu.org; Tue, 21 Jun 2016 12:28:07 -0400 Original-Received: by mail-lf0-x231.google.com with SMTP id l188so31094945lfe.2 for ; Tue, 21 Jun 2016 09:28:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=KzBlOcU/L5oOSx78rIkRQXlz9oU5Nnb3BPyb/8oLgXs=; b=UuxRdUApVVU7hxlrHHcROM+OXpkCFibVXMMynEo9J/tnwCsEfTDIYx5cIdKRmihpxJ LbgNxIiBCgyox2AdR20cL6H32rNSprnJ+b6GGKOYvUIjYeXGWyiUegVGH74PcPDZzCWE gZ2wvHZPVErE/EguhKD7bONeM1DSJ9Ul6A491MjO1LdMtUB7SRa9/IZNVTww1WzBXclS oLUmujVL7AbTq27uZw5Ea2kl6k1/GivM9C+LBUQQ33AlBDv1gSliOmQldTG1GMPJXSQy D83pKSEPTfYU+wCOn9Gyrn4QmsiMa4mzjfOiARAmDF1nrd6WeiyRjv9fybY7d+hNjiEH k8uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=KzBlOcU/L5oOSx78rIkRQXlz9oU5Nnb3BPyb/8oLgXs=; b=GcALaQ75Acghc+LlYMUvhX5uCThGumcY4LNYK6dIp6OzRM4DitGwLMDPDQUxxPmJQA fL0V42OaaZ8mITfty7e5+YsePSJ9QQ7yGhwADUVWyoOu9Edwrp51FdNLZlpVKh0l7sn/ z5ImmZP8xftQvADlp8fMINvwwt3bBwiKXqR0ERwBOpPykUYfwcOl+BpNXUoRLOp5XBuV xHS+MfLyWTCcPXaicoWcn0TkXzsi9+dCIvFE9+Pn06barYtFRCoEyF7WMUs/pE/EbEJZ iZm6rHtBmVe1kQMkAGx9N1BV94rhbjZHlnoZcYIHUhCCGVuguHeD48UfMwhsL2612nDX blBA== X-Gm-Message-State: ALyK8tKQHEdbHTL7lG6yhhIrBnh6bhWLJnJmJdDuPeipdba5CgSB5U7JZr+ZAkQ5dwYByw== X-Received: by 10.28.142.144 with SMTP id q138mr4090697wmd.30.1466526486358; Tue, 21 Jun 2016 09:28:06 -0700 (PDT) Original-Received: from [192.168.1.2] ([185.105.173.135]) by smtp.googlemail.com with ESMTPSA id ae10sm25753388wjc.13.2016.06.21.09.28.05 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2016 09:28:05 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 In-Reply-To: <20160621152653.GC3177@acm.fritz.box> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::231 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:204644 Archived-At: On 06/21/2016 06:26 PM, Alan Mackenzie wrote: >> If Emacs is supposed to keep the syntax-table value on the last >> character up to date using after-change-functions, it will have to scan >> the whole 300000 line buffer after every keypress. > > Could it not restrict the scanning to cases where a "`" is inserted or > deleted? Even if we could, it would be more like "cases where `, /, " or % are inserted or deleted" (with actually more cases, and complex logic for the cases' detection). But "auuugh Ruby Mode is slow when I type /" would be a problem anyway, just look at http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22884. > Do you not have to do the scanning anyway when you type in "`" > at the end of the "b = :`" line? I don't. ` has the syntax "string delimiter" in ruby-mode-syntax-table. When ruby-syntax-propertize is called on the last line, it just checks what (syntax-ppss POSITION-OF-THE-LAST-`) returns. If the return value says "inside a string", we do not apply syntax-table value "symbol" to the last `. Otherwise, we do. This way, the full scan is replaced with a call to (syntax-ppss), which uses cache. In more complex cases, we can go look at the actual character that begins the string (or a string-like literal) that we're currently inside, parse the text around it locally a bit, and so on, but this is always faster that scanning the whole buffer.