From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yoni Rabkin Newsgroups: gmane.emacs.devel Subject: Re: Colour selection in shr Date: Mon, 03 Nov 2014 21:10:11 -0500 Message-ID: <87lhnryav0.fsf@rabkins.net> References: <8761ex10e0.fsf@rabkins.net> <87wq7cza1n.fsf@rabkins.net> <87d294ys7y.fsf@rabkins.net> <8738a0yo7k.fsf@rabkins.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1415067058 3591 80.91.229.3 (4 Nov 2014 02:10:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Nov 2014 02:10:58 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 04 03:10:50 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XlTa6-0005sP-JL for ged-emacs-devel@m.gmane.org; Tue, 04 Nov 2014 03:10:50 +0100 Original-Received: from localhost ([::1]:38165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlTa6-0001Yu-3a for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2014 21:10:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlTZi-0001Yp-EX for emacs-devel@gnu.org; Mon, 03 Nov 2014 21:10:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlTZb-0005zd-To for emacs-devel@gnu.org; Mon, 03 Nov 2014 21:10:26 -0500 Original-Received: from smtprelay0128.hostedemail.com ([216.40.44.128]:53441 helo=smtprelay.hostedemail.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlTZb-0005zB-QG for emacs-devel@gnu.org; Mon, 03 Nov 2014 21:10:19 -0500 Original-Received: from filter.hostedemail.com (unknown [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id E941D235FC for ; Tue, 4 Nov 2014 02:10:18 +0000 (UTC) X-Session-Marker: 796F6E69407261626B696E732E6E6574 X-HE-Tag: tail01_2b05155b3500 X-Filterd-Recvd-Size: 3371 Original-Received: from yrk-ThinkPad-T410.rabkins.net (c-75-69-93-148.hsd1.nh.comcast.net [75.69.93.148]) (Authenticated sender: yoni@rabkins.net) by omf06.hostedemail.com (Postfix) with ESMTPA for ; Tue, 4 Nov 2014 02:10:18 +0000 (UTC) X-Ethics: Use GNU In-Reply-To: (Lars Magne Ingebrigtsen's message of "Mon, 03 Nov 2014 22:29:24 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 216.40.44.128 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:176327 Archived-At: --=-=-= Content-Type: text/plain Lars Magne Ingebrigtsen writes: > Yoni Rabkin 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? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-inhibit-coloration.patch >From 7b69e65059c91d93ebb82d22b8d082ad35522cb7 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin 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 yrk@gnu.org). + 2014-11-03 Stefan Monnier * 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 -- 1.7.9.5 --=-=-= Content-Type: text/plain -- "Cut your own wood and it will warm you twice" --=-=-=--