all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 29.3: enriched text SVG images
@ 2024-06-28 19:10 Christopher Howard
  2024-06-29  6:57 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Howard @ 2024-06-28 19:10 UTC (permalink / raw
  To: Help Gnu Emacs Mailing List

Hi, I wanted to submit this as a bug, but lately I keep getting in trouble for submitting bugs and then realizing I read the documentation wrong...

When I read the documentation for enriched-mode, I get the impression it is possible to save images embedded in a text/enriched document. And indeed, I can save an SVG image in the document. But for some reason when I open the document back up, the image is not displayed correctly. I tested that this behaves the same if I use "emacs -q".

M-x find-file ~/Scratch/enriched-test.txt
M-x enriched-mode
M-x eval-express (setq svg (svg-create 400 400))
M-x eval-express (svg-circle svg 200 200 50)
M-x eval-express (insert-image (svg-image (svg-circle (svg-create 400 400 :stroke "orange" :stroke-width 5) 200 200 50)))
[image is visible as expected]
M-x eval-express (setq enriched-allow-eval-in-display-props t)
[kill and reopen the buffer]

Instead of the image, I see only a small empty square. If I find-file-literally, I see that the image data is saved:

```
Content-Type: text/enriched
Text-Width: 70

<x-display><param>(image :type svg :data "<svg width=\"400\" height=\"400\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"> <circle cx=\"200\" cy=\"200\" r=\"50\"></circle></svg>" :scale 1.7009009009009008 :transform-smoothing t)</param>circle</x-display>
```

Here is my system information:

```
christopher@theoden 
------------------- 
OS: Guix System x86_64 
Host: OptiPlex 9020 00 
Kernel: 5.15.161-gnu 
Uptime: 3 days, 2 hours, 39 mins 
Packages: 167 (guix-system), 251 (guix-user) 
Shell: bash 5.1.16 
Resolution: 1920x1080 
DE: GNOME 
Theme: Adwaita [GTK2/3] 
Icons: Adwaita [GTK2/3] 
Terminal: shepherd 
CPU: Intel i5-4570 (4) @ 3.600GHz 
GPU: AMD ATI Radeon HD 8490 / R5 235X OEM 
GPU: Intel HD Graphics 
Memory: 4819MiB / 15914MiB 
```

``` guix show emacs
name: emacs
version: 29.3
outputs:
+ out: everything
systems: x86_64-linux
dependencies: acl@2.3.1 alsa-lib@1.2.4 autoconf@2.69 bash-minimal@5.1.16 binutils@2.38 cairo@1.18.0
+ coreutils@9.1 dbus@1.15.8 elogind@252.9 findutils@4.9.0 gawk@5.2.1 ghostscript@9.56.1 giflib@5.2.1 glibc@2.35
+ gnutls@3.7.7 gpm@1.20.7 gtk+@3.24.41 gzip@1.12 harfbuzz@8.3.0 jansson@2.14 lcms@2.13.1 ld-wrapper@0
+ libgccjit@10.5.0 libice@1.0.10 libjpeg-turbo@2.1.4 libotf@0.9.16 libpng@1.6.37 librsvg@2.56.4 libselinux@3.4
+ libsm@1.2.3 libtiff@4.4.0 libx11@1.8.7 libxft@2.3.4 libxml2@2.9.14 libxpm@3.5.17 m17n-lib@1.8.0
+ mailutils@3.17 ncurses@6.2.20210619 pango@1.50.14 pkg-config@0.29.2 poppler@22.09.0 sed@4.8 sqlite@3.39.3
+ texinfo@6.8 tree-sitter@0.20.10 zlib@1.2.13
location: gnu/packages/emacs.scm:445:2
homepage: https://www.gnu.org/software/emacs/
license: GPL 3+
synopsis: The extensible, customizable, self-documenting text editor  
description: GNU Emacs is an extensible and highly customizable text editor.  It is based on an Emacs Lisp
+ interpreter with extensions for text editing.  Emacs has been extended in essentially all areas of computing,
+ giving rise to a vast array of packages supporting, e.g., email, IRC and XMPP messaging, spreadsheets, remote
+ server editing, and much more.  Emacs includes extensive documentation on all aspects of the system, from
+ basic editing to writing large Lisp programs.  It has full Unicode support for nearly all human languages.
```

-- 
📛 Christopher Howard
🚀 gemini://gem.librehacker.com
🌐 http://gem.librehacker.com

בראשית ברא אלהים את השמים ואת הארץ



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 29.3: enriched text SVG images
  2024-06-28 19:10 Christopher Howard
@ 2024-06-29  6:57 ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-06-29  6:57 UTC (permalink / raw
  To: help-gnu-emacs

> From: Christopher Howard <christopher@librehacker.com>
> Date: Fri, 28 Jun 2024 11:10:03 -0800
> 
> Hi, I wanted to submit this as a bug, but lately I keep getting in trouble for submitting bugs and then realizing I read the documentation wrong...

That shouldn't stop you from reporting bugs.  Closing a bug that is
not a bug is easy, and there's no shame in reporting a bug because you
didn't know something.  So please keep reporting bugs whenever you see
something you think might be a bug.

> When I read the documentation for enriched-mode, I get the impression it is possible to save images embedded in a text/enriched document. And indeed, I can save an SVG image in the document. But for some reason when I open the document back up, the image is not displayed correctly. I tested that this behaves the same if I use "emacs -q".
> M-x find-file ~/Scratch/enriched-test.txt
> M-x enriched-mode
> M-x eval-express (setq svg (svg-create 400 400))
> M-x eval-express (svg-circle svg 200 200 50)
> M-x eval-express (insert-image (svg-image (svg-circle (svg-create 400 400 :stroke "orange" :stroke-width 5) 200 200 50)))
> [image is visible as expected]

I tried to reproduce this, but I see only an empty square at this
point.  Are you sure you have all the steps of the recipe accurate and
without mistakes?  (It definitely lacks (require 'svg) at least.)

When the image is displayed correctly, if you go to the image and type
"M-x describe-text-properties RET", what does Emacs show in a buffer
it pops up?

> M-x eval-express (setq enriched-allow-eval-in-display-props t)
> [kill and reopen the buffer]
> 
> Instead of the image, I see only a small empty square. If I find-file-literally, I see that the image data is saved:
> 
> ```
> Content-Type: text/enriched
> Text-Width: 70
> 
> <x-display><param>(image :type svg :data "<svg width=\"400\" height=\"400\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"> <circle cx=\"200\" cy=\"200\" r=\"50\"></circle></svg>" :scale 1.7009009009009008 :transform-smoothing t)</param>circle</x-display>
> ```

What do you see in *Messages* after you visit the saved file as
described above?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 29.3: enriched text SVG images
@ 2024-07-06 19:39 Christopher Howard
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Howard @ 2024-07-06 19:39 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Sorry, I copied and pasted some bad code for you. This line

```
(insert-image (svg-image (svg-circle (svg-create 400 400 :stroke "orange" :stroke-width 5) 200 200 50)))
```

should read

```
(insert-image (svg-image svg))
```

to use the previously created svg object.

-- 
Christopher Howard



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 29.3: enriched text SVG images
@ 2024-07-08 14:45 Christopher Howard
  2024-07-14  6:09 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Howard @ 2024-07-08 14:45 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Sorry, I copied and pasted some bad code for you. This line

```
(insert-image (svg-image (svg-circle (svg-create 400 400 :stroke "orange" :stroke-width 5) 200 200 50)))
```

should read

```
(insert-image (svg-image svg))
```

to use the previously created svg object.

-- 
Christopher Howard



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 29.3: enriched text SVG images
  2024-07-08 14:45 Christopher Howard
@ 2024-07-14  6:09 ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-07-14  6:09 UTC (permalink / raw
  To: help-gnu-emacs

> From: Christopher Howard <christopher@librehacker.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Mon, 08 Jul 2024 06:45:52 -0800
> 
> Sorry, I copied and pasted some bad code for you. This line
> 
> ```
> (insert-image (svg-image (svg-circle (svg-create 400 400 :stroke "orange" :stroke-width 5) 200 200 50)))
> ```
> 
> should read
> 
> ```
> (insert-image (svg-image svg))
> ```
> 
> to use the previously created svg object.

Thanks.  This bug happened because enriched-mode was duped by strings
in image specs.  Now fixed for the upcoming Emacs 30.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-14  6:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-06 19:39 29.3: enriched text SVG images Christopher Howard
  -- strict thread matches above, loose matches on Subject: below --
2024-07-08 14:45 Christopher Howard
2024-07-14  6:09 ` Eli Zaretskii
2024-06-28 19:10 Christopher Howard
2024-06-29  6:57 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.