From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 36472@debbugs.gnu.org
Subject: bug#36472: 27.0.50; Convey information by showing line numbers using different colors?
Date: Tue, 02 Jul 2019 19:27:41 +0300 [thread overview]
Message-ID: <834l44e70i.fsf@gnu.org> (raw)
In-Reply-To: <761edfce-9f36-8570-3700-a8bb5ced99b0@yandex.ru> (message from Dmitry Gutov on Tue, 2 Jul 2019 18:49:38 +0300)
> Cc: 36472@debbugs.gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
> 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.
next prev parent reply other threads:[~2019-07-02 16:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-02 11:14 bug#36472: 27.0.50; Convey information by showing line numbers using different colors? Dmitry Gutov
2019-07-02 14:30 ` Eli Zaretskii
2019-07-02 15:09 ` Dmitry Gutov
2019-07-02 15:38 ` Eli Zaretskii
2019-07-02 15:49 ` Dmitry Gutov
2019-07-02 16:27 ` Eli Zaretskii [this message]
2019-07-03 14:19 ` Dmitry Gutov
2019-07-03 16:14 ` Eli Zaretskii
2019-07-07 23:46 ` Dmitry Gutov
2019-07-08 12:23 ` Eli Zaretskii
2019-07-15 15:16 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=834l44e70i.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=36472@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.