[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch to emacs-w3m
>>>>> In [emacs-w3m : No.05922]
>>>>> Paul Kinnucan <firstname.lastname@example.org> wrote:
> As promised, here is a version of w3m-decode-entity-string
> that handles strings with multiple embedded entities without
> creating a temporary buffer.
> (defun w3m-decode-entity-string (encoded-str)
> "Decode entities in the string STR."
Thanks for the new code. However, TSUCHIYA Masatoshi also
brought up a similar code yesterday in the emacs-w3m mailing
list. It will probably be more efficient since there are less
concat's than yours. Here it is:
(defun w3m-decode-entities-string (str)
"Decode entities in the string STR."
(let ((pos 0) (buf))
(while (string-match w3m-entity-regexp str pos)
(setq buf (cons (or (w3m-entity-value (match-string 1 str)
(match-string 0 str))
(cons (substring str pos (match-beginning 0))
pos (match-end 0)))
(nreverse (if (< pos (length str))
(cons (substring str pos) buf)
Anyway, we aren't immediately going to implement the new code
now. Since there are some bugs (see below) and we should fix
them, putting similar codes on two places (w3m-decode-entities
and w3m-decode-entities-string) may confuse the development.
Katsumi Yamaoka <email@example.com>