[gnus git] branch master updated: m0-7-109-ga8c6247 =1= Make shr table rendering somewhat faster

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  a8c62470aeeb495e6ad16e5e5e7319b17611fc1c (commit)
      from  bac3aefaf4327628b01484f48bfaa0a3a501c161 (commit)


- Log -----------------------------------------------------------------
commit a8c62470aeeb495e6ad16e5e5e7319b17611fc1c
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Mon Jun 17 21:42:29 2013 +0200

    Make shr table rendering somewhat faster
    
    (shr-inhibit-decoration): New variable.
    (shr-add-font): Use it to inhibit text property decorations while doing
    preliminary table renderings.  This speeds up typical Wikipedia page
    renderings by 15%.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 36576d1..bf68393 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,10 @@
 2013-06-17  Lars Magne Ingebrigtsen  <[email protected]>
 
 	* shr.el (shr-colorize-region): Put the colours over the entire region.
+	(shr-inhibit-decoration): New variable.
+	(shr-add-font): Use it to inhibit text property decorations while doing
+	preliminary table renderings.  This speeds up typical Wikipedia page
+	renderings by 15%.
 
 	* eww.el (eww-button): New face.
 	(eww-convert-widgets): Use it to make submit buttons more button-like.
diff --git a/lisp/shr.el b/lisp/shr.el
index d348e31..f639f47 100644
--- a/lisp/shr.el
+++ b/lisp/shr.el
@@ -125,6 +125,7 @@ cid: URL as the argument.")
 (defvar shr-ignore-cache nil)
 (defvar shr-external-rendering-functions nil)
 (defvar shr-target-id nil)
+(defvar shr-inhibit-decoration nil)
 
 (defvar shr-map
   (let ((map (make-sparse-keymap)))
@@ -613,6 +614,7 @@ size, and full-buffer size."
 ;; blank text at the start of the line, and the newline at the end, to
 ;; avoid ugliness.
 (defun shr-add-font (start end type)
+  (unless shr-inhibit-decoration
   (save-excursion
     (goto-char start)
     (while (< (point) end)
@@ -621,7 +623,7 @@ size, and full-buffer size."
       (add-face-text-property (point) (min (line-end-position) end) type t)
       (if (< (line-end-position) end)
 	  (forward-line 1)
-	(goto-char end)))))
+	  (goto-char end))))))
 
 (defun shr-browse-url ()
   "Browse the URL under point."
@@ -834,7 +836,8 @@ ones, in case fg and bg are nil."
                (shr-color-visible bg fg)))))))
 
 (defun shr-colorize-region (start end fg &optional bg)
-  (when (or fg bg)
+  (when (and (not shr-inhibit-decoration)
+	     (or fg bg))
     (let ((new-colors (shr-color-check fg bg)))
       (when new-colors
 	(when fg
@@ -1021,7 +1024,8 @@ ones, in case fg and bg are nil."
 	(start (point))
 	shr-start)
     (shr-generic cont)
-    (when url
+    (when (and url
+	       (not shr-inhibit-decoration))
       (shr-urlify (or shr-start start) (shr-expand-url url) title))))
 
 (defun shr-tag-object (cont)
@@ -1397,7 +1401,8 @@ ones, in case fg and bg are nil."
 	data)))
 
 (defun shr-make-table-1 (cont widths &optional fill)
-  (let ((trs nil))
+  (let ((trs nil)
+	(shr-inhibit-decoration (not fill)))
     (dolist (row cont)
       (when (eq (car row) 'tr)
 	(let ((tds nil)

-----------------------------------------------------------------------
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 |    4 ++++
 lisp/shr.el    |   29 +++++++++++++++++------------
 2 files changed, 21 insertions(+), 12 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.