all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Evgeny Zajcev <zevlg@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: master f45ce78 2/2: Explicitly specify svg base_uri using `:base-uri' image property
Date: Sat, 19 Dec 2020 15:24:38 +0300	[thread overview]
Message-ID: <CAO=W_Zpvfn+bLmMKrQmtCEcXbTV819rXVaWRpKabS_jgb6AQyw@mail.gmail.com> (raw)
In-Reply-To: <834kkiumxt.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 1365 bytes --]

сб, 19 дек. 2020 г. в 13:09, Eli Zaretskii <eliz@gnu.org>:

> > From: Evgeny Zajcev <zevlg@yandex.ru>
> > Date: Thu, 17 Dec 2020 01:08:12 +0300
> > Cc: emacs-devel <emacs-devel@gnu.org>
> >
> > Here I've composed the patch.  As I can see NEWS already fixed
>
> Do you think the current NEWS entry is sufficiently complete and
> accurate?
>

Yeah, NEWS entries are good

The patch LGTM, with a couple of wording nits:
>
> > * doc/lispref/display.texi: Add more documentation for `:base-uri'
>
> This should mention the name of the @node where the change is done, in
> parentheses (as if it were a function).
>
> > diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
> > index 2b3119ea59..2ecd14fed9 100644
> > --- a/doc/lispref/display.texi
> > +++ b/doc/lispref/display.texi
> > @@ -5904,7 +5904,13 @@ SVG Images
> >  To @var{svg} add an embedded (raster) image placed at
> >  @var{relative-filename}.  @var{relative-filename} is searched inside
> >  @code{file-name-directory} of the @code{:base-uri} svg image property.
> > -This improves the performance of embedding large images.
> > +@code{:base-uri} specifies a (possible non-existing) filename name of
>                                  ^^^^^^^^               ^^^^^^^^^^^^^
> "possibly" and "file name".
>
>
Noted, here is the updated patch

-- 
lg

[-- Attachment #1.2: Type: text/html, Size: 2194 bytes --]

[-- Attachment #2: 0001-Improvements-for-base-uri-svg-image-property.patch --]
[-- Type: text/x-patch, Size: 2597 bytes --]

From 224ad15336f00df22609c28506ea231c2a68857d Mon Sep 17 00:00:00 2001
From: Zajcev Evgeny <zevlg@yandex.ru>
Date: Thu, 17 Dec 2020 01:04:09 +0300
Subject: [PATCH] Improvements for `:base-uri' svg image property

* src/image.c (svg_load): Use ENCODE_FILE for `:base-uri'

* doc/lispref/display.texi (SVG Images): Add more documentation for
  `:base-uri'
---
 doc/lispref/display.texi | 8 +++++++-
 src/image.c              | 8 +++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 2b3119ea59..949fd8987c 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -5904,7 +5904,13 @@ SVG Images
 To @var{svg} add an embedded (raster) image placed at
 @var{relative-filename}.  @var{relative-filename} is searched inside
 @code{file-name-directory} of the @code{:base-uri} svg image property.
-This improves the performance of embedding large images.
+@code{:base-uri} specifies a (possibly non-existing) file name of the
+svg image to be created, thus all the embedded files are searched
+relatively to the @code{:base-uri} filename's directory.  If
+@code{:base-uri} is ommited, then filename from where svg image is
+loaded is used.  Using @code{:base-uri} improves the performance of
+embedding large images, comparing to @code{svg-embed}, because all the
+work is done directly by librsvg.
 
 @lisp
 ;; Embeding /tmp/subdir/rms.jpg and /tmp/another/rms.jpg
diff --git a/src/image.c b/src/image.c
index dc06e9ce20..ba39fdc785 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9779,8 +9779,9 @@ svg_load (struct frame *f, struct image *img)
 	}
       /* If the file was slurped into memory properly, parse it.  */
       if (!STRINGP (base_uri))
-        base_uri = ENCODE_FILE (file);
-      success_p = svg_load_image (f, img, contents, size, SSDATA (base_uri));
+        base_uri = file;
+      success_p = svg_load_image (f, img, contents, size,
+                                  SSDATA (ENCODE_FILE (base_uri)));
       xfree (contents);
     }
   /* Else it's not a file, it's a Lisp object.  Load the image from a
@@ -9798,7 +9799,8 @@ svg_load (struct frame *f, struct image *img)
       if (!STRINGP (base_uri))
         base_uri = BVAR (current_buffer, filename);
       success_p = svg_load_image (f, img, SSDATA (data), SBYTES (data),
-                                  (NILP (base_uri) ? NULL : SSDATA (base_uri)));
+                                  (STRINGP (base_uri) ?
+                                   SSDATA (ENCODE_FILE (base_uri)) : NULL));
     }
 
   return success_p;
-- 
2.25.1


  reply	other threads:[~2020-12-19 12:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1938.1607798832.19112.emacs-diffs@gnu.org>
2020-12-12 19:42 ` master f45ce78 2/2: Explicitly specify svg base_uri using `:base-uri' image property Eli Zaretskii
2020-12-12 20:42   ` Evgeny Zajcev
2020-12-13 15:05     ` Eli Zaretskii
2020-12-16 22:08       ` Evgeny Zajcev
2020-12-19 10:09         ` Eli Zaretskii
2020-12-19 12:24           ` Evgeny Zajcev [this message]
2020-12-26  9:19             ` Eli Zaretskii
     [not found] <20201212124845.19694.69782@vcs0.savannah.gnu.org>
     [not found] ` <20201212124847.8879221335@vcs0.savannah.gnu.org>
2020-12-12 22:43   ` Lars Ingebrigtsen
2020-12-12 23:59     ` Alan Third
2020-12-13 12:53       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAO=W_Zpvfn+bLmMKrQmtCEcXbTV819rXVaWRpKabS_jgb6AQyw@mail.gmail.com' \
    --to=zevlg@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.