[gnus git] branch master updated: m0-7-84-gda1e266 =1= Make <body> background colour rendering prettier.
Lars Magne Ingebrigtsen <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via da1e2660b13733368e61aec91a1af315ad26df4a (commit)
from a3153a247e8631ebe793a77e819c5fee37dd833c (commit)
- Log -----------------------------------------------------------------
commit da1e2660b13733368e61aec91a1af315ad26df4a
Author: Lars Magne Ingebrigtsen <[email protected]>
Date: Sun Jun 16 15:39:38 2013 +0200
Make <body> background colour rendering prettier.
* eww.el (eww-tag-body): Override the shr body rendering so that we can
put a background colour onto the entire buffer.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e619d45..be54368 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2013-06-16 Lars Magne Ingebrigtsen <[email protected]>
+ * eww.el (eww-tag-body): Override the shr body rendering so that we can
+ put a background colour onto the entire buffer.
+
* shr.el (shr-parse-base): Fix parsing error.
* eww.el (eww-submit): Pass the base in to `shr-expand-url'.
diff --git a/lisp/eww.el b/lisp/eww.el
index 7db661c..7014003 100644
--- a/lisp/eww.el
+++ b/lisp/eww.el
@@ -105,11 +105,34 @@
(shr-external-rendering-functions
'((form . eww-tag-form)
(input . eww-tag-input)
+ (body . eww-tag-body)
(select . eww-tag-select))))
(shr-insert-document document)
(eww-convert-widgets))
(goto-char (point-min))))
+(defun eww-tag-body (cont)
+ (let* ((start (point))
+ (fgcolor (cdr (or (assq :fgcolor cont)
+ (assq :text cont))))
+ (bgcolor (cdr (assq :bgcolor cont)))
+ (shr-stylesheet (list (cons 'color fgcolor)
+ (cons 'background-color bgcolor))))
+ (shr-generic cont)
+ (eww-colorize-region start (point) fgcolor bgcolor)))
+
+(defun eww-colorize-region (start end fg &optional bg)
+ (when (or fg bg)
+ (let ((new-colors (shr-color-check fg bg)))
+ (when new-colors
+ (when fg
+ (eww-put-color start end :foreground (cadr new-colors)))
+ (when bg
+ (eww-put-color start end :background (car new-colors)))))))
+
+(defun eww-put-color (start end type color)
+ (shr-put-color-1 start end type color))
+
(defun eww-display-raw (charset)
(let ((data (buffer-substring (point) (point-max))))
(eww-setup-buffer)
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 3 +++
lisp/eww.el | 23 +++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project