From: Jinhyok Heo <novembreN0$PAM@ournature.org>
Subject: Re: emacs-w3m
Date: Fri, 25 Jan 2002 11:41:16 +0900 [thread overview]
Message-ID: <3ok7u7nodv.fsf@www.okpos.com> (raw)
In-Reply-To: <yosur8ofw757.fsf_-_@jpl.org> (Katsumi Yamaoka's message of "Fri, 25 Jan 2002 10:28:49 +0900")
>>>>> "KY" == Katsumi Yamaoka <yamaoka@jpl.org> writes:
KY> JH> I tried to use emacs-w3m. Well, it's working well except that my
KY> JH> Korean characters doesn't render correctly.
KY> JH> Is there a way I can fix it?
KY> JH> The w3m inside XEmacs renders Korean very well, but not with gnus.
KY> Thank you for the report. I've confirmed your problem. The
KY> attached text/html part is extracted from http://kr.yahoo.com/.
KY> Gnus + Emacs/w3 or T-gnus shows it correctly, but Gnus +
KY> emacs-w3m doesn't. I will consider how to fix it...
I've found the following answer to the problem from Korean emacs
mailing list(emacs-kr@debian.or.kr). Jaeyoun Chung <jay@kldp.org>
wrote it.
Well, following two lines in mm-inline-text-using-w3m gave me an error
which said there was no such function url-current-object. Maybe the
function is not in XEmacs, but in Emacs.
(url-current-object
(url-generic-parse-url (format "cid:%s" (mm-handle-id handle))))
Anyway I've commented it out and it's working well in my XEmacs.
Now I'm also happy with html mails. Thanks!
--
| Jinhyok Heo (novembre @ ournature.org || http://ournature.org/~novembre/)
|--------------------------------------------------------------------------
| "We are still reaching for the sky. In the developed countries people
| are coming back down, saying, `It's empty up there.'" --- a Ladakhi monk
##### in my .xemacs/init.el
;;; w3m
(setq w3m-display-inline-image t
w3m-command-arguments '("-no-graph")
w3m-coding-system 'euc-kr
w3m-terminal-coding-system 'euc-kr
w3m-input-coding-system 'euc-kr
w3m-output-coding-system 'euc-kr
w3m-file-name-coding-system 'euc-kr
w3m-bookmark-file-coding-system 'euc-kr
)
;; handle msoe's brain-damaged coding system
(eval-after-load "w3m"
'(pushnew '(ks_c_5601-1987 . euc-kr) w3m-charset-coding-system-alist))
(add-hook 'w3m-fontify-after-hook 'remove-w3m-output-garbages)
(defun remove-w3m-output-garbages ()
(interactive)
(let ((buffer-read-only))
(setf (point) (point-min))
(while (re-search-forward "[\200-\240]" nil t)
(replace-match " "))
(set-buffer-multibyte t))
(set-buffer-modified-p nil))
(autoload 'w3m "w3m" "Interface for w3m on Emacs." t)
(autoload 'w3m-find-file "w3m" "w3m interface function for local file." t)
(autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
(autoload 'w3m-search "w3m-search" "Search QUERY using SEARCH-ENGINE." t)
(autoload 'w3m-weather "w3m-weather" "Display weather report." t)
(autoload 'w3m-antenna "w3m-antenna" "Report change of WEB sites." t)
(setq mm-inline-text-html-renderer
'mm-inline-text-html-render-with-w3m)
##### in my .gnus.el
;; ======================================================================
;; start of w3m replacement for w3
;; ======================================================================
(defvar mm-w3m-setup nil)
(defun mm-setup-w3m ()
(unless mm-w3m-setup
(require 'w3m)
(require 'url)
(require 'url-vars)
(setq mm-w3m-setup t)) )
(defun mm-inline-text-using-w3m (handle)
(let ((type (mm-handle-media-subtype handle))
text buffer-read-only)
(cond
((equal type "html")
(mm-setup-w3m)
(setq text (mm-get-part handle))
(let ((b (point))
(url-standalone-mode t)
; (url-current-object
; (url-generic-parse-url (format "cid:%s" (mm-handle-id handle))))
(width (window-width))
(charset (mail-content-type-get
(mm-handle-type handle) 'charset)))
(save-excursion
(insert text)
(save-restriction
(narrow-to-region b (point))
(goto-char (point-min))
(delete-region (point-min) (point-max))
(insert (mm-decode-string text charset))
(save-window-excursion
(save-restriction
(let ((fill-column fill-column)
(url-standalone-mode t))
(condition-case var
(w3m-region (point-min) (point-max))
(error
(message
"Error while rendering html; showing as text/plain"))))))
(mm-handle-set-undisplayer
handle
`(lambda ()
(let (buffer-read-only)
(if (functionp 'remove-specifier)
(mapcar (lambda (prop)
(remove-specifier
(face-property 'default prop)
(current-buffer)))
'(background background-pixmap foreground)))
(delete-region ,(point-min-marker)
,(point-max-marker)))))))))
(t
(error
(message
"only html part can be rendered by `mm-inline-text-using-w3m'"))))))
(defun article-wash-html ()
"Format an html article."
(interactive)
(save-excursion
(let ((buffer-read-only nil)
charset)
(if (gnus-buffer-live-p gnus-original-article-buffer)
(with-current-buffer gnus-original-article-buffer
(let* ((ct (gnus-fetch-field "content-type"))
(ctl (and ct
(ignore-errors
(mail-header-parse-content-type ct)))))
(setq charset (and ctl
(mail-content-type-get ctl 'charset)))
(if (stringp charset)
(setq charset (intern (downcase charset)))))))
(unless charset
(setq charset gnus-newsgroup-charset))
(article-goto-body)
(save-window-excursion
(save-restriction
(narrow-to-region (point) (point-max))
(mm-setup-w3m)
(let ((url-standalone-mode t))
(condition-case var
(w3m-region (point-min) (point-max))
(error))))))))
(setq mm-inline-media-tests
(cons '("text/html"
mm-inline-text-using-w3m
(lambda (handle)
(locate-library "w3m")))
mm-inline-media-tests))
;; ======================================================================
;; end of w3m replacement for w3
;; ======================================================================
next prev parent reply other threads:[~2002-01-25 2:41 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-24 2:38 emacs-w3m Katsumi Yamaoka
2002-01-24 2:51 ` emacs-w3m Daniel Pittman
2002-01-24 3:26 ` emacs-w3m Katsumi Yamaoka
2002-01-24 6:11 ` emacs-w3m Katsumi Yamaoka
2002-01-25 13:29 ` emacs-w3m Niels Olof Bouvin
2002-01-25 18:15 ` emacs-w3m Josh Huber
2002-01-26 2:40 ` emacs-w3m Jinhyok Heo
2002-01-26 3:07 ` emacs-w3m ShengHuo ZHU
2002-01-24 13:37 ` emacs-w3m Per Abrahamsen
2002-01-24 11:28 ` emacs-w3m Jinhyok Heo
2002-01-25 1:28 ` emacs-w3m Katsumi Yamaoka
2002-01-25 2:34 ` emacs-w3m Katsumi Yamaoka
2002-01-25 3:05 ` emacs-w3m Jinhyok Heo
2002-01-25 2:41 ` Jinhyok Heo [this message]
2002-01-24 22:19 ` emacs-w3m Florian Weimer
2002-01-24 22:49 ` emacs-w3m François Pinard
2002-01-26 22:36 ` emacs-w3m Steinar Bang
2002-01-28 2:36 ` emacs-w3m Patric Mueller
2002-01-28 11:32 ` emacs-w3m Katsumi Yamaoka
2002-01-31 15:48 ` emacs-w3m Dirk Meyer
2002-02-01 8:09 ` emacs-w3m Katsumi Yamaoka
2002-02-06 13:29 ` emacs-w3m Dirk Meyer
2002-02-12 18:45 ` emacs-w3m Florian Weimer
2002-02-12 19:27 ` emacs-w3m François Pinard
2002-01-24 23:10 ` emacs-w3m Katsumi Yamaoka
2002-01-27 1:33 ` emacs-w3m Raja R Harinath
2002-01-28 1:30 ` emacs-w3m Katsumi Yamaoka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ok7u7nodv.fsf@www.okpos.com \
--to=novembren0$pam@ournature.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).