Draw and Scribble Notes in GNU Emacs
SVG seems to be quite handy for quick note-taking. You can easily draw simple shapes, use symbols from an SVG library and augment it with some freehand drawing. Combined with excellent keyboard editing of Emacs, you'll not miss anything while taking notes.
Installation
When you are drawing programmatically, you need to be able to track nodes by unique ids. e.g. if you call (svg-circle) followed by (svg-rect) using the same id, you should end up with an SVG rectange node. With out of the box svg.el, you'll end up with SVG circle node with attributes from (svg-rect). Hence canvas mode will not work with out of the box svg.el as is.Till my patch which addresses this issue is merged in Emacs core (see https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg00798.html ), you'll need to add following commands in your init file (~/.emacs) to use it.
;; Assuming you have downloaded svg.el to ~/
(load "~/svg.el")
(require 'svg)
Usage
- Run M-x canvas-mode .This will insert an SVG image (400x400 pixels) at the point. If the point already contains an SVG image, it will use the same for drawing.
If you want to edit an existing SVG file, run C-u M-x canvas-mode.
- Minibuffer shows the current active shape (default is polyline).
- Use keyboard to select appropriate shape, stroke-color, fill-color or stroke width.
- Use mouse click and drag to draw the shape.
- Selection: Use mouse to draw a rectangular region containing the objects to be selected. Use ESC to cancel selection.
- Undo: Undo the last drawn object. If selection is active, deletes the selected objects.
- Eraser: Use x to select eraser. However, do remember that erasing in SVG is more like erasing a painting. You are not really removing anything - only adding a white paint in certain regions. You can use polyline with desired fill color and stroke width for finer control.
- Zoom: Use selection to zoom in. Use 0 to reset zoom. Use +/- to zoom in/out.
- Use s to save the SVG file. Important: Emacs save buffer action will only save the text content. You must save SVG file separately.
- Enter q or RETURN to exit the mode.
l | Line |
c | Circle |
r | Rectangle |
e | Ellipse |
t | Text |
p | Polyline |
w | Stroke Width |
f |
Fill color |
C |
Stroke color |
z (+, -, 0) |
Zoom |
x |
Eraser |
M-w | Copy |
m | Move |
g | Group |
G | Ungroup |
M-g | Toggle grid |
y |
Selection mode |
ESC |
Cancel Selection |
R | Rotate |
W | Connection wire |
L | Symbol Library |
s | Save SVG |
u | Undo |
q/RETURN | Quit |
References
- https://github.com/larsmagne/ewp/blob/master/ewp.el
FAQ
- Can text and images be intermixed in a buffer? Yes.
- Is there an eraser tool? Yes.
- You need GTK (on Linux) and librsvg support compiled in Emacs for this to work.
Comments
Post a Comment