bastibe / annotate.el

Annotate.el
Other
384 stars 20 forks source link

[new feature] using margins to print annotation's text #123

Open cage2 opened 2 years ago

cage2 commented 2 years ago

Emacs have, indeed, margins as display property:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Display-Margins.html

Annotations could be displayed there.

Problems:

Comments welcome! :) Bye! C.

bastibe commented 2 years ago

That looks useful indeed! If I remember correctly, however, the margins are a fixed portion of the buffer width. I thought they were mostly used for single-character "annotations", like the little arrow that says a line continues off screen.

So if we enlarge to the margins to print into them, this might restrict the buffer width, and cut off long lines. I might be wrong, though.

The advantage of our current approach is that we can have a long, non-intrusive annotation at the end of a short line, and overflow gracefully for long lines. This flexibility would probably be lost if we print to the margins.

But at any rate, there's nothing wrong with providing both display methods as an option. Perhaps even chosen automatically based on the frame width (and content width?).

cage2 commented 2 years ago

Hi!!

That looks useful indeed!

I think the same!

If I remember correctly, however, the margins are a fixed portion of the buffer width. I thought they were mostly used for single-character "annotations", like the little arrow that says a line continues off screen.

I was confused at first (i was remembering the same as you) but if I have read correctly the documentation what you are mentioning here are the fringe indicators:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Fringe-Indicators.html

While the margin are also an unreachable portion of the buffer but can contains arbitrary text (again if i did not checked wrong the documentation).

https://www.gnu.org/software/emacs/manual/html_node/elisp/Display-Margins.html

So if we enlarge to the margins to print into them, this might restrict the buffer width, and cut off long lines. I might be wrong, though.

I quite sure you are right, I think we have to try and see the results, i am thinking making this way to display annotations optional, but who knows? Maybe we could like so much the margins that this could be the default in the future, we'll see!

Bye! C.

bastibe commented 2 years ago

I think there was some discussion about customizable display styles at some point. At the time we were musing different styles such as

And we could add more ideas, like

Anyway, that's all just ideas. It'll be interesting to play with a few variants and see how they behave in practice!

cage2 commented 2 years ago

Hi!

Unfortunately i have bad news for this feature: the text on the margin can not be split in multiple lines, and this is an hard stop for annotate.el to take advantage of Emacs margins. :(

(unless a better idea comes to someone of course! :-) )

Probably we could use margins to display images instead of text, but this needs a bit of investigation.

Bye! C.

bastibe commented 2 years ago

It might be possible to show an icon in the margin, with the annotation in a tooltip. But I'm just thinking out loud here, so this might be a bad idea 😁.

cage2 commented 2 years ago

Hi!

It might be possible to show an icon in the margin, with the annotation in a tooltip. But I'm just thinking out loud here, so this might be a bad idea grin.

As we already have the option to show the annotation in a tooltip (even if this behaviour was incidental! :)) i think would be a wonderful improvement to put an icon/button in the margin that - when pressed- shows the annotations! I definitely want to investigate if such feature is doable!

Bye! C.

bastibe commented 2 years ago

By the way: I don't use annotate.el frequently, as most of our workflows involve integrated tools like gitlab. But yesterday I did a code review for one of my students, and got to use annotate.el for it. It truly is a joy to use! Thank you for maintaining it!

cage2 commented 2 years ago

Hi!

[...] yesterday I did a code review for one of my students, and got to use annotate.el for it. It truly is a joy to use! Thank you for maintaining it!

Thank you very much! To me this is one of the most appreciated phrase that can be wrote to someone that dedicated a lot of their spare time writing free software! :)

Bye! C.