[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r102482: shr.el (shr-color->hexadecim
From: |
Katsumi Yamaoka |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r102482: shr.el (shr-color->hexadecimal): Autoload. |
Date: |
Tue, 23 Nov 2010 08:21:09 +0000 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 102482
author: Lars Magne Ingebrigtsen <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Tue 2010-11-23 08:21:09 +0000
message:
shr.el (shr-color->hexadecimal): Autoload.
shr.el (shr-descend): Add color to all tags and remove the tag-font and
tag-span functions.
modified:
lisp/gnus/ChangeLog
lisp/gnus/shr.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog 2010-11-23 00:03:44 +0000
+++ b/lisp/gnus/ChangeLog 2010-11-23 08:21:09 +0000
@@ -1,3 +1,8 @@
+2010-11-23 Lars Magne Ingebrigtsen <address@hidden>
+
+ * shr.el (shr-color->hexadecimal): Autoload.
+ (shr-descend): Add color to all tags.
+
2010-11-22 Julien Danjou <address@hidden>
* shr.el (shr-tag-color-check): Convert colors to hexadecimal with
=== modified file 'lisp/gnus/shr.el'
--- a/lisp/gnus/shr.el 2010-11-23 00:03:44 +0000
+++ b/lisp/gnus/shr.el 2010-11-23 08:21:09 +0000
@@ -191,10 +191,17 @@
(nreverse result)))
(defun shr-descend (dom)
- (let ((function (intern (concat "shr-tag-" (symbol-name (car dom)))
obarray)))
+ (let ((function (intern (concat "shr-tag-" (symbol-name (car dom))) obarray))
+ (style (cdr (assq :style (cdr dom))))
+ (start (point)))
+ (when (and style
+ (string-match "color" style))
+ (setq style (shr-parse-style style)))
(if (fboundp function)
(funcall function (cdr dom))
- (shr-generic (cdr dom)))))
+ (shr-generic (cdr dom)))
+ (when (consp style)
+ (shr-insert-color-overlay (cdr (assq 'color style)) start (point)))))
(defun shr-generic (cont)
(dolist (sub cont)
@@ -485,6 +492,20 @@
"Encode URL."
(browse-url-url-encode-chars url "[)$ ]"))
+(autoload 'shr-color-visible "shr-color")
+(autoload 'shr-color->hexadecimal "shr-color")
+(defun shr-color-check (fg &optional bg)
+ "Check that FG is visible on BG."
+ (shr-color-visible (or (shr-color->hexadecimal bg)
+ (frame-parameter nil 'background-color))
+ (shr-color->hexadecimal fg) (not bg)))
+
+(defun shr-insert-color-overlay (color start end)
+ (when color
+ (let ((overlay (make-overlay start end)))
+ (overlay-put overlay 'face (cons 'foreground-color
+ (cadr (shr-color-check color)))))))
+
;;; Tag-specific rendering rules.
(defun shr-tag-p (cont)
@@ -517,31 +538,6 @@
(defun shr-tag-s (cont)
(shr-fontize-cont cont 'strike-through))
-(autoload 'shr-color-visible "shr-color")
-(defun shr-tag-color-check (fg &optional bg)
- "Check that FG is visible on BG."
- (shr-color-visible (or (shr-color->hexadecimal bg)
- (frame-parameter nil 'background-color))
- (shr-color->hexadecimal fg) (not bg)))
-
-(defun shr-tag-insert-color-overlay (color start end)
- (when color
- (let ((overlay (make-overlay start end)))
- (overlay-put overlay 'face (cons 'foreground-color
- (cadr (shr-tag-color-check color)))))))
-
-(defun shr-tag-span (cont)
- (let ((start (point))
- (color (cdr (assq 'color (shr-parse-style (cdr (assq :style cont)))))))
- (shr-generic cont)
- (shr-tag-insert-color-overlay color start (point))))
-
-(defun shr-tag-font (cont)
- (let ((start (point))
- (color (cdr (assq :color cont))))
- (shr-generic cont)
- (shr-tag-insert-color-overlay color start (point))))
-
(defun shr-parse-style (style)
(when style
(let ((plist nil))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r102482: shr.el (shr-color->hexadecimal): Autoload.,
Katsumi Yamaoka <=