On Mon, Dec 06 2010, Lars Magne Ingebrigtsen wrote: > Let's see... yup: > > (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 does now that I changed some code to things like: (defun shr-tag-font (cont) - (let ((start (point)) - (color (cdr (assq :color cont)))) - (shr-generic cont) - (shr-colorize-region start (point) color))) + (let* ((start (point)) + (color (cdr (assq :color cont))) + (shr-stylesheet (if color + `((color . ,fgcolor) ,@shr-stylesheet) + shr-stylesheet))) + (shr-generic cont))) OTOH, there was a subtle bug. You wrote: (shr-stylesheet (list (cons :color fgcolor) (cons :background-color bgcolor)))) Initially, where as it should have been 'color and 'background-color (: vs quote). So maybe I fixed too much stuff because of that. ;) > (let ((color (cdr (assq 'color shr-stylesheet))) > (background (cdr (assq 'background-color > shr-stylesheet)))) > (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). -- Julien Danjou // ᐰ http://julien.danjou.info