unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 61816@debbugs.gnu.org
Subject: bug#61816: 30.0.50; [PATCH] New user option 'doc-view-svg-honor-theme'
Date: Thu, 02 Mar 2023 19:20:30 +0100	[thread overview]
Message-ID: <875ybjuia9.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <83ttz3cdx2.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 02 Mar 2023 18:32:09 +0200")

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

[...]

> Fine by me, that's what I proposed.

Wow, it is cleaner and works even better (no need to change page to
update colors).  Thanks.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-a-face-for-DocView-SVG.patch --]
[-- Type: text/x-patch, Size: 2609 bytes --]

From 0f3ff5af9610fbf173f07218d652c1be3477dc14 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Thu, 2 Mar 2023 19:16:19 +0100
Subject: [PATCH] Use a face for DocView SVG

* lisp/doc-view.el (doc-view-svg-face): New face for SVG images.
(doc-view-insert-image): Use it.
---
 etc/NEWS         |  6 ++++++
 lisp/doc-view.el | 19 ++++++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 116b60d8b11..88c3f2f0ef4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -208,6 +208,12 @@ bound to 'C-c C-d' in 'go-ts-mode'.
 When this is non-nil, call the 'man' program synchronously rather than
 asynchronously (which is the default behavior).
 
+** DocView
+
+---
+*** New face 'doc-view-svg-face'.
+This replaces 'doc-view-svg-foreground' and 'doc-view-svg-background'.
+
 \f
 * New Modes and Packages in Emacs 30.1
 
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 0303fec67a6..b14655fb274 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -236,17 +236,14 @@ doc-view-imenu-flatten
   :type 'boolean
   :version "29.1")
 
-(defcustom doc-view-svg-background "white"
-  "Background color for svg images.
+(defface doc-view-svg-face '((t :inherit default))
+  "Face used for SVG images.  Only background and foreground colors
+are used.
 See `doc-view-mupdf-use-svg'."
-  :type 'color
-  :version "29.1")
+  :version "30.1")
 
-(defcustom doc-view-svg-foreground "black"
-  "Foreground color for svg images.
-See `doc-view-mupdf-use-svg'."
-  :type 'color
-  :version "29.1")
+(make-obsolete 'doc-view-svg-background 'doc-view-svg-face "30.1")
+(make-obsolete 'doc-view-svg-foreground 'doc-view-svg-face "30.1")
 
 (defcustom doc-view-ghostscript-options
   '("-dSAFER" ;; Avoid security problems when rendering files from untrusted
@@ -1602,8 +1599,8 @@ doc-view-insert-image
                           (unless (member :transform-smoothing args)
                             (setq args `(,@args :transform-smoothing t)))
                           (when (eq doc-view--image-type 'svg)
-                            (setq args `(,@args :background ,doc-view-svg-background
-                                               :foreground ,doc-view-svg-foreground)))
+                            (setq args `(,@args :background ,(face-background 'doc-view-svg-face)
+                                                :foreground ,(face-foreground 'doc-view-svg-face))))
 			  (apply #'create-image file doc-view--image-type nil args))))
 	     (slice (doc-view-current-slice))
 	     (img-width (and image (car (image-size image))))
-- 
2.39.1


[-- Attachment #3: Type: text/plain, Size: 18 bytes --]

-- 
Manuel Giraud

  reply	other threads:[~2023-03-02 18:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-26 15:33 bug#61816: 30.0.50; [PATCH] New user option 'doc-view-svg-honor-theme' Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-02 12:39 ` Eli Zaretskii
2023-03-02 13:12   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-02 13:56     ` Eli Zaretskii
2023-03-02 15:40       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-02 15:51         ` Eli Zaretskii
2023-03-02 15:57           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-02 15:51         ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-02 16:32           ` Eli Zaretskii
2023-03-02 18:20             ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-03-09 10:06               ` Eli Zaretskii
2023-03-03  2:28           ` Visuwesh
2023-03-03  7:31             ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=875ybjuia9.fsf@ledu-giraud.fr \
    --to=bug-gnu-emacs@gnu.org \
    --cc=61816@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).