From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Limits of multiline font-lock Date: Sun, 15 Sep 2019 08:28:21 -0400 Message-ID: References: <87impuu7qy.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="147590"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Emacs Development To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 15 14:32:49 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i9Thw-000cHS-OI for ged-emacs-devel@m.gmane.org; Sun, 15 Sep 2019 14:32:49 +0200 Original-Received: from localhost ([::1]:54364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9Thv-0006V8-Ej for ged-emacs-devel@m.gmane.org; Sun, 15 Sep 2019 08:32:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51355) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9Tdo-0003rX-Qt for emacs-devel@gnu.org; Sun, 15 Sep 2019 08:28:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9Tdn-0004Wm-8d for emacs-devel@gnu.org; Sun, 15 Sep 2019 08:28:32 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48052) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i9Tdn-0004WU-2F for emacs-devel@gnu.org; Sun, 15 Sep 2019 08:28:31 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3A903447C8E; Sun, 15 Sep 2019 08:28:30 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 62C6E447C87; Sun, 15 Sep 2019 08:28:24 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1568550504; bh=T2C8Z0upNNt8lhOYMA0/XwoPHs4iqOcz6L1VMrrSpTs=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=MwzA/frDqBY8/ocY/ioGM2VNZia+er2mD6Uh7mO+mnBRmmKWIpOLUXlcdET4SUUP1 TwJ19kQRVq5rbahpayQFQKTFM8S0IKriQo5JoFoQFCuKQOg7Hc7ZzGZ36DW07eQdl8 lObMQwF+t9KQR0s7kTO5W+wtepG9gucmqZCI02cGfXsb+lBgFlniAncY5UIZbt53mL uE9Xto7IF3lPWojj+JyaIsp7T6J7cjOrvmnm0ataJHWUJ8HL7ndReF242fOh0Jg9Nm TlBFVAAz/O6WUFDMfzA44zkpljrlkscvZsPmzxl0Aq4hAhW5/CgycgQnd4MFZcGM3w XYAIL723PQPNw== Original-Received: from pastel (104-222-123-223.cpe.teksavvy.com [104.222.123.223]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 230B4120372; Sun, 15 Sep 2019 08:28:24 -0400 (EDT) In-Reply-To: <87impuu7qy.fsf@web.de> (Michael Heerdegen's message of "Sat, 14 Sep 2019 19:07:17 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:240045 Archived-At: > I want to provide a hi-lock like feature for el-search patterns: an on > the fly highlighting of any expressions matching a certain el-search > pattern. Elisp expressions can be multiline, of course. After reading what > the manual says about multiline font lock I'm not sure if I can use > font-lock for that. I think before deciding which tools to use, I think you need to figure out how you want to solve the fundamental difficulty: - we're inside an arbitrary buffer with your new el-search-hi-lock functionality enabled for a particular pattern. - let's assume for now that currently there's no match anywhere. - then the user makes an edit at line N which makes the pattern match on lines M to M' (M < N and M' > N). How do you plan on finding this match? - You can scan the whole buffer from point-min, but that might be too costly (tho maybe it's OK if you do it from an idle timer). - Or you can add limits like "we'll only look for it between N-5 and N+5" and we don't care if we don't notice new "hard to find" matches. - Or you can rely on the earlier scans having noted that the text between M and N matches the beginning of the pattern and hence only need to check whether, after the edit, the new text starting at N matches "the rest of the pattern". - ... Stefan