From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Colorful line numbers Date: Fri, 22 Jul 2022 16:27:56 +0300 Message-ID: <831qudl1k3.fsf@gnu.org> References: <87leslpow2.fsf@gmail.com> <83ilnpl8e0.fsf@gnu.org> <874jz9peq0.fsf@gmail.com> <837d45l6ge.fsf@gnu.org> <87zgh1nyo6.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2746"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 22 15:29:16 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEsiS-0000YK-5K for ged-emacs-devel@m.gmane-mx.org; Fri, 22 Jul 2022 15:29:16 +0200 Original-Received: from localhost ([::1]:36490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEsiQ-00034K-FW for ged-emacs-devel@m.gmane-mx.org; Fri, 22 Jul 2022 09:29:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEshG-0001yD-K2 for emacs-devel@gnu.org; Fri, 22 Jul 2022 09:28:02 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEshG-0005Fw-AW; Fri, 22 Jul 2022 09:28:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=OgfOSOkOZbYxwgzIOL654AgAOnRsfWyZRrvbSF5rt/8=; b=Vnnk1Poy+OYMZ0eRJv/f T32SPmdQDjKkZ5DtMEz0OhQHzsUy98WB0RQKWAikUDo68t1aZru9NZpqdqEf17M/XbwfuUzvnEekl f3udKLkuVbeHZ7xHt82T8f26am+JrT1u2Hbcg7mRw20nO6NxcXX8pANKaLVopfHPvlfBkkAAhlV4v d439dtbxEeeOqyqC76UBNZQ1Qmt9zkuuP+eR4rABoYZY4Vmz20jqRfM2sjOA08Tl612zALIFk8b04 4LQLSvjijJpZPdcfdrn47r8QRqFeXOyz/rsD4lhLbux2QXOEYB0EP8c04FToGDi5BTjXHov1mHK65 reB3m8Ajnj4+cA==; Original-Received: from [87.69.77.57] (port=2973 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEshE-00016R-JG; Fri, 22 Jul 2022 09:28:01 -0400 In-Reply-To: <87zgh1nyo6.fsf@gmail.com> (message from =?utf-8?B?Sm/Do28g?= =?utf-8?B?VMOhdm9yYQ==?= on Fri, 22 Jul 2022 13:02:01 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:292433 Archived-At: > From: João Távora > Cc: emacs-devel@gnu.org > Date: Fri, 22 Jul 2022 13:02:01 +0100 > > Eli Zaretskii writes: > > >> Does checking for a given text property on some buffer text call into > >> Lisp? If it isn't, and it's cheap, then this hypothetical feature could > >> have very low overhead when not used. > > You want the line number to have the same face as the character > > displayed immediately after it? > > Not the "same face", rather some face which is the result of querying > text properties on that text. I don't understand what that means. Querying the properties how? And doing what with the results of those queries? Eventually, you need a face. > > That can be done from C without calling Lisp, but how would that work > > reliably? Any change in the buffer text will risk breaking the > > feature. > > It's up to the Lisp package that is interested in this functionality to > set or unset the correct text property. Well, good luck with that! Because I don't think this can be reasonably implemented from Lisp: there are too many aspects involved that are hidden from Lisp. > > And even this is already a complication I'd like to avoid: line number > > of a line is rendered before we examine the buffer text of the line > > (and even know whether there is any text there). Now we would need to > > look forward in the buffer and get text properties of that text. > > Which might not work correctly, btw, if jit-lock was not yet invoked > > to produce the faces there. > > See above. This wouldn't be a problem because I'm not interesting in > choosing the same face that jit-lock selected. The indirection would be > some text property, say line-number-face I guess this gets back to the question about "queries" and their processing? > > The implementation is in maybe_produce_line_number in xdisp.c. > > Yes, I've seen it (this is would I discovered the closed set of faces). > But I'm not familiar with xdisp.c code and how to get to the buffer text > about to be displayed besides the line number (if it indeed exists) and > the associated text properties of that text. The only argument passed > to maybe_produce_line_number is a 'struct it'. How to go from there to > any valid buffer position of the same line that the 'struct it' refers > to? The answer depends on the condition(s) which that "valid buffer position" should satisfy. In general, IT_CHARPOS(*it) gives you the next buffer position to be processed.