[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: Emacs-W3m bug about highlight .



>>>>> In [emacs-w3m : No.10192]
>>>>>	Andy Stewart <lazycat.manatee@xxxxxxxxx> wrote:

---------------------> code start <---------------------------
> (setq w3m-use-filter t)
> (defun my-w3m-filter-for-google-cn (&rest args)
>   "Replace <font color=CC0033> tags with <b>'s."
>   (goto-char (point-min))
>   (while (re-search-forward "<font color=CC0033>\\([^<]+\\)</font>" nil t)
>     (replace-match "<b>\\1</b>")))
> (eval-after-load "w3m-filter"
>   '(add-to-list 'w3m-filter-rules
>                 '("\\`http://www\\.google\\.cn/";
>                   my-w3m-filter-for-google-cn)))
--------------------> code end <-------------------------------

> But today, i update Emacs-W3m CVS version (2008-06-02), the Chinese
> keyword (example "中国") can't highlight in the google search pages.

How about replacing the regexp as follows?

(defun my-w3m-filter-for-google-cn (&rest args)
  "Replace <font color=\"#cc0033\"> tags with <b>'s."
  (goto-char (point-min))
  (while (re-search-forward "<font color=\"#cc0033\">\\([^<]+\\)</font>" nil t)
    (replace-match "<b>\\1</b>")))