From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: Limits of multiline font-lock Date: Mon, 16 Sep 2019 01:13:52 +0200 Message-ID: <87sgoxjgpb.fsf@web.de> 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="49140"; 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: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 16 01:16:41 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 1i9dl2-000CfW-GH for ged-emacs-devel@m.gmane.org; Mon, 16 Sep 2019 01:16:40 +0200 Original-Received: from localhost ([::1]:57624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9dl0-0000ar-KJ for ged-emacs-devel@m.gmane.org; Sun, 15 Sep 2019 19:16:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33599) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9diX-0000ac-IG for emacs-devel@gnu.org; Sun, 15 Sep 2019 19:14:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9diW-0007lq-JQ for emacs-devel@gnu.org; Sun, 15 Sep 2019 19:14:05 -0400 Original-Received: from mout.web.de ([212.227.15.14]:33543) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i9diW-0007js-7m for emacs-devel@gnu.org; Sun, 15 Sep 2019 19:14:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1568589232; bh=ye6u+ebqwxEBAnu7wd3JZXsq5SdRwfnUJ28Ix6y8/SE=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=UJ7XGo9Ua9KkcTS9/fYPWLks9zxsYbD7qly7BWuFnAnZmo2c9zQDVY3pZuoYnceD5 QoFxYpoKNJX9B/O1rIIREvD6W+a3kUGPLNBwaMkMjEuPXwCOOic0iuYB6hHrNSeXBO hEptSR/VLzbFwIMqTypUGl4qIO1vu8Awg6x39xx4= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([94.216.136.59]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MWRkA-1hc5M21Mbq-00XcSL; Mon, 16 Sep 2019 01:13:52 +0200 In-Reply-To: (Stefan Monnier's message of "Sun, 15 Sep 2019 08:28:21 -0400") X-Provags-ID: V03:K1:0ByOu8zqBHt4CXXbKHiuK8xv+vT5euPM79CuhqVwQ6JOVJf+ZS3 wCNIR4evmaPLmU0izB5JCJlLwsxZb3UEy9byk5SL1IAbZQZ/tkheK4dWHKEKBdmk8x1TY4/ DHOdMLA6pyDbb7CDtYcILFKrvr6U/jzmNCCDEydSWTLkcXzM1UDq9Z0BYDqQoDlHJKIycvC QQ6cC3u1dtQey0mRqWErQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:oG8xjYk+gEI=:Sbyzbl3VI+ArqTPT/leyMr CwG3AXJfxoVymuvbPJwtc46lAkJMTkGKdcS+Tf2vZhMmFXdQgdJ+j1vIl52rG9GKQdGExHLDB VqWdP278sIAeubtu2ABiryT1J8SdnPt8d/+nWbLLNsmbdI2H9RLxku8mAKa+jOi+jWCMwYg2a kcB9kXQygv5dMkLq/5xDV6FEClY0P+NkI6JoCtl60lK8JRWbijfx3yihCKfAKk9oI37/SkdcI VZteynhn3wNTezOziHECf1r5vm/yhU9A+TuoubkJReHyyuPvvBbYOT9/eimfkV/OHgutoDkVC e+HGZRREHU3poZxlIy3OO6OHDMjkSuwioLZfLQqDOv5vh82NL/EiAxD+WiZDEyU4AlYwIjopt IjV7pOD0R+pKs/6lvH1OS0i9qD2nruQKgM1zo/jLafgelcc6nqNa/CVdW+Amaliu38CFpWq4G rXVShkVz/NWo1kLPKrOk7IaBpyGHpn62+Hqnf7dWzZu3yKgxBgoBUQliPw424h/5wbWqYl3Av iwFoOB9mbE6bSSWrdp+U1AuQA/xuhThnLM725vLxrI9GaovQI/jUbWGHdPbmM+oyPMEu5096A aC5g+7xqP0fTk5Sc0/vwHBI/i0ZOQeEmxqQAHLdd8hVHn/uTv8otyhBDqCvoVCPHoPI9qHfD1 SdkHtcMXiHaedPDC2uVjKl4NkV/bJUs0wNmHf8Tonm1uxkw+e92qIaK19BphjAjS9JSscKqh4 B0DB7pSZIPEHTk3KKMTO9m/G+7diXW8FAVVec7xWMbSvA8fjfCCVMmS/AXTM4IHYMLp0TIeR X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.14 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:240061 Archived-At: Stefan Monnier writes: > 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. Must be an emacs-lisp buffer, of course. > - 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? Matches are always limited by bounds of the current top-level expression. A complete re-search from the beg-of-defun of window-start up to window-end after a change is sufficient and doable in acceptable time (in your concrete scenario, I could even restrict the search to all parent sexps the edited text is in - most of the time these will no ever be more than 20 or so...these can be tested very quickly). I already have a prototype (not based on font-lock), and it starts refontification only after a (tiny) idle time, and the search function is interruptable (via throw-on-input). When interrupted, the old visible state is restored. This works quite nicely and feels quite natural unless the search pattern is very costly (then I currently emit a warning - the pattern could also remove itself from the list or turn the minor mode off). The tricky rest is now stuff that font-lock already does well. My current implementation has problems with cases like when different (maybe overlapping) parts of a buffer are visible in different windows, there is a certain risk of infinite retriggering of hi-locking etc. Thanks, Michael.