* lisp/net/shr.el (shr-tag-li): Speed up rendering pages with lots of <ul>

This commit is contained in:
Lars Magne Ingebrigtsen 2015-02-13 15:51:23 +11:00
parent 65563fd771
commit 10a5a054ac
2 changed files with 13 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2015-02-13 Lars Ingebrigtsen <larsi@gnus.org>
* net/shr.el (shr-tag-li): Speed up rendering pages with lots of
<ul>.
2015-02-12 Oleh Krehel <ohwoeowho@gmail.com>
* progmodes/gdb-mi.el (gdb-display-io-nopopup): New defcustom.

View file

@ -157,6 +157,7 @@ cid: URL as the argument.")
(defvar shr-table-separator-pixel-width 0)
(defvar shr-table-id nil)
(defvar shr-current-font nil)
(defvar shr-internal-bullet nil)
(defvar shr-map
(let ((map (make-sparse-keymap)))
@ -216,6 +217,8 @@ DOM should be a parse tree as generated by
(shr-table-id 0)
(shr-warning nil)
(shr-table-separator-pixel-width (shr-string-pixel-width "-"))
(shr-internal-bullet (cons shr-bullet
(shr-string-pixel-width shr-bullet)))
(shr-internal-width (or (and shr-width
(if (not shr-use-fonts)
shr-width
@ -1408,11 +1411,13 @@ The preference is a float determined from `shr-prefer-media-type'."
(prog1
(format "%d " shr-list-mode)
(setq shr-list-mode (1+ shr-list-mode)))
shr-bullet)))
(car shr-internal-bullet)))
(width (if (numberp shr-list-mode)
(shr-string-pixel-width bullet)
(cdr shr-internal-bullet))))
(insert bullet)
(shr-mark-fill start)
(let ((shr-indentation (+ shr-indentation
(shr-string-pixel-width bullet))))
(let ((shr-indentation (+ shr-indentation width)))
(put-text-property start (1+ start)
'shr-continuation-indentation shr-indentation)
(put-text-property start (1+ start) 'shr-prefix-length (length bullet))