From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#36472: 27.0.50; Convey information by showing line numbers using different colors? Date: Tue, 02 Jul 2019 19:27:41 +0300 Message-ID: <834l44e70i.fsf@gnu.org> References: <83blycecf7.fsf@gnu.org> <835zoke9at.fsf@gnu.org> <761edfce-9f36-8570-3700-a8bb5ced99b0@yandex.ru> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="205040"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 36472@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 02 19:51:03 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1hiMvm-000qOm-RK for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Jul 2019 19:51:02 +0200 Original-Received: from localhost ([::1]:55742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiMi6-0003DM-2r for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Jul 2019 13:36:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48672) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiLeQ-0005Lw-SG for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2019 12:29:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hiLeP-0007jJ-S1 for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2019 12:29:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hiLeP-0007j3-O1 for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2019 12:29:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hiLeP-0003OS-Ib for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2019 12:29:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Jul 2019 16:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36472 X-GNU-PR-Package: emacs Original-Received: via spool by 36472-submit@debbugs.gnu.org id=B36472.156208488712985 (code B ref 36472); Tue, 02 Jul 2019 16:29:01 +0000 Original-Received: (at 36472) by debbugs.gnu.org; 2 Jul 2019 16:28:07 +0000 Original-Received: from localhost ([127.0.0.1]:47770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hiLdX-0003NN-6s for submit@debbugs.gnu.org; Tue, 02 Jul 2019 12:28:07 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hiLdV-0003Mt-FP for 36472@debbugs.gnu.org; Tue, 02 Jul 2019 12:28:06 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hiLdN-0006sQ-IH; Tue, 02 Jul 2019 12:27:58 -0400 Original-Received: from [176.228.60.248] (port=3884 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hiLdM-0000Oy-54; Tue, 02 Jul 2019 12:27:57 -0400 In-reply-to: <761edfce-9f36-8570-3700-a8bb5ced99b0@yandex.ru> (message from Dmitry Gutov on Tue, 2 Jul 2019 18:49:38 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161968 Archived-At: > Cc: 36472@debbugs.gnu.org > From: Dmitry Gutov > Date: Tue, 2 Jul 2019 18:49:38 +0300 > > (defvar display-line-number-renderers-functions nil > "The line number (a string) is mapped through all of the functions in > this list, in turn. Each receives it as an argument, and then the return > value is used. The functions are called in the buffer for which the line > numbers are displayed, at the beginning of a line which corresponds to > the given number.") > > (add-hook 'display-line-number-renderers 'diff-hl-line-number-renderer) > > (defun diff-hl-line-number-renderer (line-number-string) > (cl-case (get-text-property (point) 'diff-hl-indicator-type) > ...) I still have some questions: . The argument is a line-number string. You expect the absolute line number there? When the line-number display style is 'relative' or 'visual', the absolute line number might not be available. . What kind of object is the return value, and how should the display engine use it? . You seem to assume the hook will be called at point, but that is not true: it will be called where the display engine is scanning the buffer. So you need that position (the beginning of line or something) in the interface, or else you will need to calculate the position from the line number, not a nice prospect. . The display engine is sometimes called to scan buffer positions outside of the window, so you should either detect that or be sure to place your properties/overlays not only in the window. Is that a problem? . What are the triggers for changing these properties/overlays? Are they determined once and for all, or can they change after the buffer has been created and populated with the text? If some changes in the buffer affect visual appearance of screen lines that are otherwise unaffected by the changes, it would mean disabling redisplay optimizations when this feature is used. For example, with 'relative' style, moving point to another line requires to redraw all the lines in the window. In general, calling Lisp from the display engine means complications and all kinds of silly precautions, to protect ourselves from crazy Lisp, so I'm still not very fond if the idea, sorry.