From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: Question about display engine Date: Sat, 7 Sep 2019 04:35:44 +0200 Message-ID: <20190907023542.quc4rttfm4yr5m7t@Ergus> References: <318675867.1913640.1567711569517.ref@mail.yahoo.com> <318675867.1913640.1567711569517@mail.yahoo.com> <8336h97qiw.fsf@gnu.org> <20190906103023.3r7aa5spkie3cca6@Ergus> <831rwt7dvv.fsf@gnu.org> <20190906163456.7kfylavswxvgrfhv@Ergus> <83y2z15m6h.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="90079"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: rudalics@gmx.at, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 07 04:37:03 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 1i6Qb1-000NI5-H3 for ged-emacs-devel@m.gmane.org; Sat, 07 Sep 2019 04:37:03 +0200 Original-Received: from localhost ([::1]:33130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6Qaz-00040V-QP for ged-emacs-devel@m.gmane.org; Fri, 06 Sep 2019 22:37:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35107) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6Qa2-00040A-2s for emacs-devel@gnu.org; Fri, 06 Sep 2019 22:36:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i6Qa0-00064h-5A for emacs-devel@gnu.org; Fri, 06 Sep 2019 22:36:01 -0400 Original-Received: from sonic313-22.consmr.mail.ir2.yahoo.com ([77.238.179.189]:43648) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i6QZz-00064L-VW for emacs-devel@gnu.org; Fri, 06 Sep 2019 22:36:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1567823757; bh=t6ajcYM/sD3n1oNUc9wvj1gBbayhOCJfUV/k3/4aWD0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=YK0yvWcwIBA0omOg1CVV0GvJb/9o71QMYDaDGff4w4kWsYLhZJWCRa0wgdG86iJikQYzCGTFGm4YTCcfOjR57mgOLXEqYRihsK7xpp4CCmL7U1ODsQlLDo+VAq29/T4CgDhkFD5/ShZlAiRYVDBIZ6LOkeUCXNwJL1sXc4L8mJydF+YegKs6QL3BEXPyZ55PS27cY8HRcpfVXACMXN0PlPU1/vMtFLOSI7heUcdcmmIO2UP4Xika2DxQfsD7MPH8WnfzVwLZJegMrTUzWPhdSkbMXZvuofXc9ZcklgGL4Q7imHZl0roz4SIC+bucCspr7RADSQeAoqvIEQG2nh1w/A== X-YMail-OSG: 9pwB0fsVM1kyWWSwW.6msJuPg7y7EjdsyO9n8NMqj5xUFCi6FePXrn.joUfdMSx jyKLYj_zDMqgqki1_1tFzWLAdI0ZX3PJQteXB.AWuuTWvZus_yNk.2XtAGWsfp_dm7eSwH45u0bN Ya2QXa3.QNpwv33IOy2zSp3IEBfYEXfqeqrStQEECCkvHkvjtrKngSUCXRHSAr02K7R5YiftUb6c nNh7UgoaUnGVLzNLbpfE6yl4zchafJRUsXhMj1lQ.80Q8DBucTmiJR4740_vNS6KaMVe7t1gqUKK tkWFe2zR8ldDJAlZ23OS9kDnSzqhanz7LRiVrMJcKEKVNFOx3lhVS9ZU8lJEV9X5TTAEfLjz5MNA 4Hae_q2BULaBoP83VHNpZr5FhslZbUmAQ3RMD4Yzz7X32nVObGrN3KeymeUMZVU1Jtxifsg5fJQW oVHml3_Dfj283D9qYLUDI6m4ta6Dex8tYUx8H59kkM1t8HoKx3gmvmjrgYCgn61zDuQO8n8SStuu ArCmlo0VrELhOoMPZnNt9AglvF4OcZpBd8rXO.J7pluMkn.S9__30Tc5re6XZNo8MK7rfHzJ1OLF 48MmknB0zMZUXWoIs3A7act3PBNWgN4B0XcJ99tYToJ2nF19PRQ6vmeo1CxWCFR5O1sDQ6CmkkQT 6CFM.BUBQVliOZT1O38dVzqeFKW97pnZAfSzPsO35HJEB4gYzIwG0sa6gouUWAs3T7YeHkxPFH_D IfU9unzGhhupVZtQlb_W9MZVGf3aUuYLfX7nV1ghAvS_raHV3X3Lo6Ze2G7V4dUqx3ID8NpkVQyR 4uz15p0QcohBPcHkLcGae6xdzqak2b_VmXT4yeYNt4 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Sat, 7 Sep 2019 02:35:57 +0000 Original-Received: by smtp430.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID fb34b3a9ec63667b60cf1150edc800d9; Sat, 07 Sep 2019 02:35:56 +0000 (UTC) Content-Disposition: inline In-Reply-To: <83y2z15m6h.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 77.238.179.189 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:239910 Archived-At: On Fri, Sep 06, 2019 at 09:12:06PM +0300, Eli Zaretskii wrote: >> Date: Fri, 6 Sep 2019 18:34:56 +0200 >> From: Ergus >> Cc: rudalics@gmx.at, emacs-devel@gnu.org >> >> When you say a variant you mean another function to call directly from >> extend_face_to_end_of_line? > >Yes. > >> Sorry I still don't understand where is (a + >> b + c + d) computed or where emacs "remembers" that, or if it is >> computed all the time. But maybe the trick is actually in >> face_at_buffer_position, face_for_overlay_string or >> face_at_string_position? > >face_at_buffer_position and face_at_string_position collect all the >faces that affect a given buffer/string position, and then they merge >these faces to produce the face ID to be used by the iterator. By >"remember" I meant that if you call face_at_buffer_position for any >position between stop positions A and A+1, it will produce the same >face ID, because the face properties don't change between stop >positions. The data structures maintained by Emacs that determine the >faces in effect for a particular position is what "remembers" these >faces for you. > >> If so; then what we really need is a variant of face_at_buffer_position >> like extend_face_at_buffer_position? (or add to it a parameter to do >> what we want) does it makes any sense. >> >> handle_face_prop can't be modified as it should have a specific >> prototype. But we can make it a wrapper and create a generalized or use >> ITERATOR_AT_END_OF_LINE_P internally? > >What I meant is to write a function like handle_face_prop, but one >that instructs face_at_buffer/string_position to merge the relevant >faces in a special way, one that takes the :extend attribute into >account. Whether the code will be similar enough to what >handle_face_prop does now to make them use the same code, is a >separate question; I wouldn't be bothered by that at this time. First >let's have code that we understand and that works; we can bother about >cleaning up and optimizing later. > Hi Eli: In your solution I am facing an issue that I am not sure how to solve: I added a function handle_face_prop_general; that I call in extend_face_to_end_of_line but I get an inf loop because in the call stack I have: extend_face_to_end_of_line handle_face_prop_general face_at_buffer_position Fget_text_property Ftext_properties_at validate_interval_range That has a condition: if (!(BUF_BEGV (b) <= XFIXNUM (*begin) && XFIXNUM (*begin) <= XFIXNUM (*end) && XFIXNUM (*end) <= BUF_ZV (b))) args_out_of_range (*begin, *end); And for some reason: XFIXNUM (*end) <= BUF_ZV (b) is false; so the function args_out_of_range emits a signal and never returns. It is possible that in the first calls to extend_face_to_end_of_line the BUF_ZV (b) is not initialized yet? Because it is always 1. when I print it.