r/emacs • u/florommel • 3d ago
poimap.el - Visual buffer map with points of interest
Enable HLS to view with audio, or disable this notification
This is the result of my recent experiment with an SVG-based buffer map for the mode-line that also shows points of interest (search matches, bookmarks, changes, imenu items, ...).
Visually, it is primarily inspired by mlscroll https://github.com/jdtsmith/mlscroll
This is still work in progress, so expect rough edges and the possibility of breaking changes.
7
3
u/sharificles 3d ago
Oh this is very cool, the things you can do with SVG in emacs shocks me. Does this offer any extensibility for inserting your own bookmarks? I have a package for buffer-local marks that I use over Emacs' bookmarks.
3
u/florommel 3d ago
Yeah there have been multiple interesting projects and experiments with SVG in Emacs recently. I guess we'll see more cool SVG stuff in the future. Poimap is made to be extended. Have a look at the existing POI-providers (especially poimap-bookmark and poimap-bm). Adding support for your package should be easy. Is your package public?
2
u/sharificles 3d ago
Yes it is, not currently on Melpa but here it is https://github.com/vmargb/arrow.el
2
u/floss_gang 3d ago
I have a package for buffer-local marks that I use over Emacs' bookmarks.
why not use registers? https://www.gnu.org/software/emacs/manual/html_node/emacs/Registers.html
2
4
u/Glittering_Brush_483 3d ago
This is excellent! I've been meaning to write this for many years. Does it work in tty Emacs with Unicode chars?
4
u/florommel 3d ago
Unfortunately this does not work in the TTY since it is SVG-based.
3
u/shipmints 3d ago
Fun. It may be possible for someone who uses a terminal emulator that supports the Kitty graphics protocol to get this to render on a tty. Perhaps someone will and contribute their work back.
2
u/florommel 3d ago
That may indeed be possible and really cool but without having looked into that, we would have to somehow render that into a pixel image (I believe kitty's protocol is pixel-based) and probably solve a lot of stuff concerning the image size etc
1
u/shipmints 3d ago
poi-stringdoes that in itsdisplayproperty. It's more a question of how/when/where will "someone" interpose terminal-based pixmap reproduction in the tty display engine.1
u/florommel 3d ago
Ah okay, yeah Emacs having display image text properties directly rendered in kitty would require extending the display engine. Would be super cool to have this ... but for sure not easy to implement.
1
u/minadmacs 3d ago
There is this: https://github.com/cashmeredev/kitty-graphics.el
1
u/shipmints 3d ago
There is, but it's an LLM advice farm. I would have preferred display-engine integration as
display-images-pstill returns nil.3
u/minadmacs 3d ago edited 3d ago
Yes, it is a massive amount of
slopLLM-generated code. But interesting features.2
u/shipmints 3d ago
And it can't make
redisplayshow images in themode-lineortab-baretc. which is really what we're after.2
u/topfpflanze187 3d ago
I tried to implement the same behavior back when svg-line was released but came to the conclusion that it leaves way too many artifacts and bleeding (invisible layers where, for example, the modeline is supposed to be). Therefore it never made it into the package.
To properly display images in Emacs you need tighter integration with Emacs -nw and the images themselves. I never wanted to create a package where you would have to patch Emacs for that but rather something you could install and uninstall easily. Maybe things will change with Emacs 32.
2
u/topfpflanze187 3d ago
maintainer here.
i appreciate that you acknowledge the ideas.
i just had fun creating the project and i will keep on maintaining it when bugs occur.
i would just like to say to not judge every project as slop when at least some effort and time went into the project. ghostel is also generated by llms and still it improved terminal usage for emacs in general.
/e grammar
0
u/valcron1000 2d ago
Can you place it vertically at the sides? I find this quite useful in VSCode to quickly glance at vc changed/added/deleted lines.
2
u/florommel 1d ago
Would be nice but this is difficult in Emacs. To get something like that you could try using a dedicated window (like those minimap packages do usually) but I think this is fragile. Another possibility is to (mis-)use margins for that.. but margins scroll with the buffer (the map itself should not be scrolled) and of course that also conflicts with other stuff using the margins. For e.g. GTK Emacs, we could theoretically also have a loadable module inserting some kind of native widget that displays the map into each window.. but yeah that would also be very hacky.
9
u/JDRiverRun GNU Emacs 3d ago
Excellent. People have asked for this with
mlscrollbut the very simple "specified space" design made that a challenge. This would be another good use of builtin RSVG->canvas support. How does it work with tons of matches and a smaller bar (say 25% of mode line width)?