emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102483: shr-color.el: fix several fu


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102483: shr-color.el: fix several function calls.
Date: Tue, 23 Nov 2010 10:22:49 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102483
author: Julien Danjou <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Tue 2010-11-23 10:22:49 +0000
message:
  shr-color.el: fix several function calls.
  shr.el: replace newline with space in style parsing
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/shr-color.el
  lisp/gnus/shr.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-11-23 08:21:09 +0000
+++ b/lisp/gnus/ChangeLog       2010-11-23 10:22:49 +0000
@@ -1,3 +1,10 @@
+2010-11-23  Julien Danjou  <address@hidden>
+
+       * shr.el (shr-parse-style): Replace \n with space in style parsing.
+
+       * shr-color.el (shr-color-hsl-to-rgb-fractions): Use 
shr-color-hue-to-rgb.
+       (shr-color->hexadecimal): Call shr-color-hsl-to-rgb-fractions.
+
 2010-11-23  Lars Magne Ingebrigtsen  <address@hidden>
 
        * shr.el (shr-color->hexadecimal): Autoload.

=== modified file 'lisp/gnus/shr-color.el'
--- a/lisp/gnus/shr-color.el    2010-11-23 00:03:44 +0000
+++ b/lisp/gnus/shr-color.el    2010-11-23 10:22:49 +0000
@@ -54,6 +54,15 @@
         (/ (* (string-to-number (substring number 0 string-length)) 255) 100)
       (string-to-number number))))
 
+(defun shr-color-hue-to-rgb (x y h)
+  "Convert X Y H to RGB value."
+  (when (< h 0) (incf h))
+  (when (> h 1) (decf h))
+  (cond ((< h (/ 1 6.0)) (+ x (* (- y x) h 6)))
+        ((< h 0.5) y)
+        ((< h (/ 2.0 3.0)) (+ x (* (- y x) (- (/ 2.0 3.0) h) 6)))
+        (t x)))
+
 (defun shr-color-hsl-to-rgb-fractions (h s l)
   "Convert H S L to fractional RGB values."
   (let (m1 m2)
@@ -61,9 +70,9 @@
         (setq m2 (* l (+ s 1)))
         (setq m2 (- (+ l s) (* l s))))
     (setq m1 (- (* l 2) m2))
-    (list (rainbow-hue-to-rgb m1 m2 (+ h (/ 1 3.0)))
-         (rainbow-hue-to-rgb m1 m2 h)
-         (rainbow-hue-to-rgb m1 m2 (- h (/ 1 3.0))))))
+    (list (shr-color-hue-to-rgb m1 m2 (+ h (/ 1 3.0)))
+         (shr-color-hue-to-rgb m1 m2 h)
+         (shr-color-hue-to-rgb m1 m2 (- h (/ 1 3.0))))))
 
 (defun shr-color->hexadecimal (color)
   "Convert any color format to hexadecimal representation.
@@ -89,7 +98,7 @@
                  (s (/ (string-to-number (match-string-no-properties 2 color)) 
100.0))
                  (l (/ (string-to-number (match-string-no-properties 3 color)) 
100.0)))
              (destructuring-bind (r g b)
-                 (rainbow-hsl-to-rgb-fractions h s l)
+                 (shr-color-hsl-to-rgb-fractions h s l)
                (format "#%02X%02X%02X" (* r 255) (* g 255) (* b 255)))))
           (t
            color))))

=== modified file 'lisp/gnus/shr.el'
--- a/lisp/gnus/shr.el  2010-11-23 08:21:09 +0000
+++ b/lisp/gnus/shr.el  2010-11-23 10:22:49 +0000
@@ -540,6 +540,9 @@
 
 (defun shr-parse-style (style)
   (when style
+    (save-match-data
+      (when (string-match "\n" style)
+        (setq style (replace-match " " t t style))))
     (let ((plist nil))
       (dolist (elem (split-string style ";"))
        (when elem


reply via email to

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