Subject: bug#36472: 27.0.50; Convey information by showing line numbers using different colors?

From: Dmitry Gutov <[email-masked]>
Date: Tue, 2 Jul 2019 18:49:38 +0300

On 02.07.2019 18:38, Eli Zaretskii wrote:

> I don't understand: who would need to look up overlays?  And how will
> "it" know that it needs to look up overlays?

The function that diff-hl would add to the said hook. So it will know.

> IOW, I don't think I understand the API you had in mind.  You
> originally said "a hook", which implies the display engine would call
> a hook variable, but now it sounds like you had something else in
> mind.

Something like:

(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)
     ...)