Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Writing a custom treater for HTML articles
@ 2010-10-28 18:56 Sean McAfee
  2010-10-29 21:50 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Sean McAfee @ 2010-10-28 18:56 UTC (permalink / raw)
  To: info-gnus-english

As I noted in an earlier article, choosing w3m for mm-text-html-renderer
takes a very long time on large messages, while w3m-standalone is much
faster, but produces plainer output.  I tried to write a function that
dispatches to one or the other based on the size of the message, but so
far without success.  Here was my effort:

(defun render-html-appropriately ()
  (if (< (buffer-size) 50000)
      (gnus-article-wash-html-with-w3m)
    (gnus-article-wash-html-with-w3m-standalone)))

When I viewed an HTML message, I got this error:

  mm-inline-text-html: Wrong number of arguments: (...), 1

So apparently an argument is expected, but I can't tell what it is;
mm-inline-text-html is not documented.  I rewrote my function:

(defun render-html-appropriately (&rest args)
  (insert (format "%s" args)))

Now this gets inserted into the message buffer:

  (( *mm*<3> (text/html) nil nil nil nil nil nil))

Not very helpful.

What's the right way to write a renderer?  The docs suggest to me that
the rendering function would simply be called without arguments in the
buffer to be treated, but apparently it's more complicated than that.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Writing a custom treater for HTML articles
  2010-10-28 18:56 Writing a custom treater for HTML articles Sean McAfee
@ 2010-10-29 21:50 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-10-29 21:50 UTC (permalink / raw)
  To: info-gnus-english

Sean McAfee <eefacm@gmail.com> writes:

> So apparently an argument is expected, but I can't tell what it is;
> mm-inline-text-html is not documented.

These functions are called with a MIME handle as a parameter.  See the
"Handles" section in the Emacs MIME manual for the accessors.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-29 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 18:56 Writing a custom treater for HTML articles Sean McAfee
2010-10-29 21:50 ` Lars Magne Ingebrigtsen

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).