[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make a drawing with Emacs

From: Stefan Monnier
Subject: Re: make a drawing with Emacs
Date: Thu, 03 Sep 2020 12:59:01 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> 1) It is not clear upfront, when it does not work, as demonstrated with
>>>    svg-image vs svg-print.
>>>    This is general problem with foreign dependencies.
>> I believe svg-image is the only exception and it's an intuitive one at

It seems `svg-insert-image` is another exception.

> Sorry it wasn't intuitive to me as I don't know emacs internals (yet?).


>> since it is used to create an internal Emacs image object whose only
>> use is to display the image inside an Emacs buffer.
> There seem to be other uses as well, e.g. to save the image (image-save
> function).  Maybe other uses like create a screenshot?

That doesn't seem related to `svg.el` which focuses on generating the
XML representation of an SVG image (with one or two extra help functions
like `svg-image` which also tries to help *display* that image).
Searching for `save` only finds a single match (and it's for
`save-excursion` and it's not even in the code but in a comment).

> image.el also has some questionable constraints.

`svg.el` is unrelated to `image.el` (except via `svg-image`, AFAIK).

>> Or maybe you can improve the package instead of writing a new one.
>> Code is sometimes called "software" because presumably it's more
>> malleable than "hardware".
> Maybe.  svg.el seems to be 4 years old and likely has many users
> already.

Probably not "many", but then again, the more users it has, the higher
the benefit of improving it rather than writing another one.

> The fake keyword args as rest args plist was a bad choice 4
> years ago which will be hard to fix.  What would be the right way to do
> this if not writing svg2.el?  Perhaps to implement proper keyword
> support in Elisp?

The answer probably depends on exactly how else you want to handle
those properties.  I don't know what "proper keyword support" you're
thinking of, but if you're thinking of Common List keywords, then you
can simply change `defun` into `cl-defun` and then use `&key`.

BTW, if you're only concerned about the Eldoc and `C-h o` info, then you
can also just provide the more precise info in the docstring e.g.:

    (defun svg-create (width height &rest args)
      "Create a new, empty SVG image with dimensions WIDTH x HEIGHT.
    ARGS can be used to provide `stroke' and `stroke-width' parameters to
    any further elements added.


-- Stefan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]