From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/74773 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.gnus.general Subject: Re: [gnus git] branch master updated: =2= shr: colorize only in one place ; shr: shr-colorize-region fix and stylesheet color retrieval fix Date: Mon, 06 Dec 2010 17:22:49 +0100 Organization: Programmerer Ingebrigtsen Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1291652604 18408 80.91.229.12 (6 Dec 2010 16:23:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 6 Dec 2010 16:23:24 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M23129@lists.math.uh.edu Mon Dec 06 17:23:20 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PPdqR-0005id-9m for ding-account@gmane.org; Mon, 06 Dec 2010 17:23:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PPdqF-0005DH-ML; Mon, 06 Dec 2010 10:23:07 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PPdqE-0005D4-Ef for ding@lists.math.uh.edu; Mon, 06 Dec 2010 10:23:06 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PPdq9-0006kc-K3 for ding@lists.math.uh.edu; Mon, 06 Dec 2010 10:23:06 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1PPdq8-0003Vf-00 for ; Mon, 06 Dec 2010 17:23:00 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PPdq8-0005Xt-Ob for ding@gnus.org; Mon, 06 Dec 2010 17:23:00 +0100 Original-Received: from cm-84.215.34.171.getinternet.no ([84.215.34.171]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Dec 2010 17:23:00 +0100 Original-Received: from larsi by cm-84.215.34.171.getinternet.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Dec 2010 17:23:00 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-Lines: 58 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cm-84.215.34.171.getinternet.no Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXX0L+ilYvGw74MBgfB vLWzrqh6Y1w+JCSm1CHsAAACDUlEQVQ4jXWST4+bMBDFzR6aa6yCc00t+gEiS+tzkJNcFzXAFSsw cy2isb9+x9hJs8n2WQI0P94b/2PjuZKPKo00FQ02Gim37FmyJGAWy5tkMhW3NAwbInijQYUF0oc8 3B3/RGVZfQbbm1OaA0U9GYjIEEWgeilH8MmSol7BbZmvPaJB/gwO+uHZ8eWsHsGD4+0G0gJLepb3 H8oFnE3SoTLyByedqwA6dZfmPJdNuQeeE/gVKj6SnKboeGFMXkfg/JxAaQQFmSIC7SzOydHmoV0C HgAwAC645Rw4pCjveL+AvWsdds53hwVo34uest5hPx1PgAOKBGDNss3si291i2hxsLtzBJazDBTw Vde4o+1g/JMctmCZUP5jtfdW2NbVRbOAd7TkmPV6dUSw2O38KUY5gILhRX+s2tyPgN6J6PA0cZxR s64tnLFor9fUw+UCFf5mlxY3he2G67VJYMxQY5+p1tZI7cHeoka20RPrFJ2FCAfCx+RYs5Xq2SUA +wC8nxgDxmbVAngSwAK0Rt/T7c+UbmHZfY3JAegInJQWGE/SR+BYhmtGLRQIpb/v6D0twDYHTkmX 6Ahgij1oImTYULaFCNxytB6IsD21peYRwBDATNPjTWir203oMatpaNh40rN3IOYEFk1jE+8VrVG9 gMcr2oR7BBRQEKjhLtrUZad43hBovtb/QH0D9TP4C45RDbE4j9scAAAAAElFTkSuQmCC Mail-Copies-To: never X-Now-Playing: Sandy Denny's _Complete Recordings 11 (Gold Dust: Live at the Royalty)_: "Solo" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:bCQFIYqDpblD2DrP9V5Zdmxw0jo= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:74773 Archived-At: Julien Danjou writes: >> (when (and style >> (string-match "color" style)) >> (setq shr-stylesheet (nconc (shr-parse-style style) >> shr-stylesheet))) >> >> We add our stuff to what our parent(s) had... > > I think you're cheating. :) > > Yes you are inheriting, I did not change that code, but the parent did > not set the background-color in shr-styleshset. It adds all the stuff from style="" to the (inherited) style sheet, so if background-color is present, it's inherited. > It does now that I changed some code to things like: [...] > (defun shr-tag-font (cont) Yeah, I didn't do . Wasn't part of my test case. :-) > Initially, where as it should have been 'color and 'background-color > (: vs quote). > So maybe I fixed too much stuff because of that. ;) Yeah, I think so. :-) >> (when (and shr-stylesheet >> (or color background)) >> (shr-colorize-region start (point) color background))))) >> >> ... and then use it. >> >> Should work, I think. Well, actually, it's rendering things too much -- >> it should have a (and (string-match "color" style)) in there, too, >> probably. > > shr-colorize-region does nothing if both colors are nil, so I don't > think there is too much to optimize here, unless assq is considered to > be slow (I don't know). If any parent had color/background-color, then shr-colorize-region will be called with those colours. That's the optimisation problem: (let ((color (cdr (assq 'color shr-stylesheet))) (background (cdr (assq 'background-color shr-stylesheet)))) shr-stylesheet here isn't the style="" from the current tag, but the inherited one (that includes the current tag, at this point). -- (domestic pets only, the antidote for overdose, milk.) larsi@gnus.org * Lars Magne Ingebrigtsen