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

Re: Emacs-w3m Bug



>>>>> In [emacs-w3m : No.09941] Lazycat Manatee wrote:

> Hi, the developers of emacs-w3m. Thank you for develop this great application.

You're welcome.  Thank you for the information about emacs-w3m.

> I'm use emacs-w3m version 1.5 in emacs 23.0.60.2.

> I use below bug when in google:
> If i use keyword "emacs" search in
> "http://www.google.co.jp"; and "http://www.google.com/intl/en/"; the
> "emacs" can highlight in textarea, and bold in title.
> But when i use "emacs" search in "http://www.google.cn"; the "emacs"
> can't highlight in textarea, and bold in title. only can highlight in
> url

As far as I observed, google.cn uses <font color=CC0033>Emacs</font>
for highlighting while the others use <b>Emacs</b>.  The reason
<font ...> is not processed as expected is that the external w3m
command neither lets them pass through, nor supports transforming
such tags into the ones that emacs-w3m can handle, while generating
a halfdump.  For example:

$ echo '<font color=CC0033>Emacs</font>'| w3m -halfdump -T text/html
Emacs
<internal>
</internal>

Because of this, there is no function that processes colors that
the web page specifies in <font ...> tags either in emacs-w3m.
On the other hand,

$ echo '<b>Emacs</b>'| w3m -halfdump -T text/html<b>Emacs</b>
<b>Emacs</b>
<internal>
</internal>

emacs-w3m highlights it with the bold face.  Therefore, there is
currently no way to highlight words in google.cn pages
unfortunately, except for the use of the filter.  If you are
interested in it, try something like the following in your
~/.emacs-w3m.el file:

--8<---------------cut here---------------start------------->8---
(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)))
--8<---------------cut here---------------end--------------->8---

> And other bug, if i search keyword in google use Japanese or English,
> the highlight is right,
> but i search keyword in google use Chinese, example "日本", the
> highlight is wrong, can't highlight in pages.

I think this is due to the same reason above.

> This is bug, or my setup about emacs-w3m is wrong.

We may call it the lack of a function of both emacs-w3m and w3m
probably.

Regards,