Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cage2 opened this issue Feb 6, 2022 · 8 comments
Open

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

cage2 opened this issue Feb 6, 2022 · 8 comments

Comments

@cage2
Copy link
Collaborator

cage2 commented Feb 6, 2022

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:

  • horizontal position (left? Right? Depending of the language?)
  • vertical position (on the first line of the annotated text or on the last?)
  • replace current way of display annotations? Or add this new way of displaying as optional, an in that case, what default?
  • ...

Comments welcome! :)
Bye!
C.

@bastibe
Copy link
Owner

bastibe commented Feb 7, 2022

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
Copy link
Collaborator Author

cage2 commented Feb 8, 2022 via email

@bastibe
Copy link
Owner

bastibe commented Feb 9, 2022

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

  • annotations after the end of the annotated line
  • annotations always on the next (virtual) line
  • annotations at a fixed X-position on the line
  • annotations intelligently choosing a good position (the way we do it now)

And we could add more ideas, like

  • annotations in the margin
  • annotations in the minibuffer only
  • annotations in the tooltip only
  • annotations that pop up if under point
  • annotations in a floating child frame
  • etc.

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

@cage2 cage2 mentioned this issue Apr 28, 2022
@cage2
Copy link
Collaborator Author

cage2 commented May 26, 2022

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
Copy link
Owner

bastibe commented May 30, 2022

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
Copy link
Collaborator Author

cage2 commented Jun 2, 2022

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
Copy link
Owner

bastibe commented Jun 2, 2022

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
Copy link
Collaborator Author

cage2 commented Jun 3, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants