Now you can use SVG widget in GNU Emacs. That is, use an SVG image
or fragment as background for push-button widget in Emacs buffer. You
can also specify the width and height of the widget for finer control.
Generally speaking, you can use any type of image for this purpose. But
SVG suits best because you can draw widget of any size without any
distortion.
The ability to use SVG fragment means
you can define multiple symbols in an SVG and use the same as a sprite
sheet for your UI requirements. Thus the number of files to be managed
is reduced.
Another use case would be better
looking customize form. Or at the very least, rounded "Save" and
"Cancel" buttons. In other words, a more visually appealing UI in
graphical environments while maintaining the promise of Emacs in
terminal.
Sample API: svg-widget (svg frag &optional width height &rest args)
Code: https://gitlab.com/atamariya/emacs/-/blob/dev/lisp/svg.el
Details: https://lifeofpenguin.blogspot.com/2021/10/svg-widget-in-gnu-emacs.html
Patch
modified lisp/wid-edit.el
@@ -353,6 +353,7 @@ widget-specify-button
"Specify button for WIDGET between FROM and TO."
(let ((overlay (make-overlay from to nil t nil))
(follow-link (widget-get widget :follow-link))
+ (display (widget-get widget :display))
(help-echo (widget-get widget :help-echo)))
(widget-put widget :button-overlay overlay)
(if (functionp help-echo)
@@ -360,6 +361,7 @@ widget-specify-button
(overlay-put overlay 'button widget)
(overlay-put overlay 'keymap (widget-get widget :keymap))
(overlay-put overlay 'evaporate t)
+ (overlay-put overlay 'display display)
;; We want to avoid the face with image buttons.
(unless (widget-get widget :suppress-face)
(overlay-put overlay 'face (widget-apply widget :button-face-get))