[Top][All Lists]

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

Re: Colour selection in shr

From: Yoni Rabkin
Subject: Re: Colour selection in shr
Date: Mon, 03 Nov 2014 21:10:11 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Lars Magne Ingebrigtsen <address@hidden> writes:

> Yoni Rabkin <address@hidden> writes:
>> A defcustom in shr.el which stops shr from coloring stuff won't make eww
>> stop coloring everything.
> Why not?  eww can look at shr variables just as much as shr can.
>> To repeat: eww.el:eww-colorize-region is eww's own private copy of
>> shr.el:shr-colorize-region.
> Looks like a something left over for hysterical raisins.  I've now
> removed the eww version of the function.

In which case, can we use something like this?

>From 7b69e65059c91d93ebb82d22b8d082ad35522cb7 Mon Sep 17 00:00:00 2001
From: Yoni Rabkin <address@hidden>
Date: Mon, 3 Nov 2014 20:59:08 -0500
Subject: [PATCH] Add option to inhibit coloration.

 lisp/ChangeLog  |    3 +++
 lisp/net/shr.el |    7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ac78e34..9d104ed 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -9,6 +9,9 @@
        * net/shr.el: Ditto.
+       * net/shr.el: Add option to inhibit color rendering (patch by Yoni
+       Rabkin address@hidden).
 2014-11-03  Stefan Monnier  <address@hidden>
        * emacs-lisp/edebug.el (edebug-safe-prin1-to-string): Assume that
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 5db0324..ccaba20 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -106,6 +106,12 @@ Alternative suggestions are:
   :group 'shr
   :type 'boolean)
+(defcustom shr-inhibit-coloration nil
+  "Non nil means that colors will not be rendered."
+  :version "24.4"
+  :group 'shr
+  :type 'boolean)
 (defvar shr-content-function nil
   "If bound, this should be a function that will return the content.
 This is used for cid: URLs, and the function is called with the
@@ -920,6 +926,7 @@ ones, in case fg and bg are nil."
 (defun shr-colorize-region (start end fg &optional bg)
   (when (and (not shr-inhibit-decoration)
+            (not shr-inhibit-coloration)
             (or fg bg))
     (let ((new-colors (shr-color-check fg bg)))
       (when new-colors

   "Cut your own wood and it will warm you twice"

reply via email to

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