Hi Ken

Where do you set the value of url in the second function?

One big enhancement shall be setting the coding system of the temp buffer, based on the charset of the html page.

Regards,
Denny

On Thu, Jul 29, 2010 at 7:46 AM, ken <gebser@mousecar.com> wrote:
Lennart suggested I use a different defun, url-copy-file.  I tried that
instead, but it didn't work.  But then I went back to my original code,
moved a single parenthesis and... it worked... mostly.  Here's the code:

------------------------ start ---------------------------
load url.el

(defun www-edit-web-page (url)
 "Retrieve web page and load into new buffer for editing.
Automatically insert after <body> tag URL, appropriately html-tagged URL."
 (interactive "sLoad URL: ")
 (with-temp-buffer (url-retrieve url 'edit-web-page)))


(defun edit-web-page (status)
     "Switch to the buffer returned by `url-retreive'.
   The buffer should contain the web page sent by the server."
     (switch-to-buffer (current-buffer))
   (goto-char 0)
   (re-search-forward "<body.*>" nil t) ;go to end of <body ...> tag.
   ;insert URL into page
   (insert "\n<p>From: <a href=\"" url "\">" url "</a>\n </p>\n\n"))

------------------------ ende ---------------------------

This properly fetches the web page and loads it into a new, unsaved
buffer (exactly what I want), but the last line in the second defun
doesn't execute.  The error messages are telling me that edit-web-page
doesn't know the value of "url".  So how do I pass this variable-- with
its assignment from www-edit-web-page to edit-web-page?  (I have a
guess, but i'm more a C/bash/blah/blah/blah guy, so elisp is a bit
mysterious.)






--
Thanks & Regards

Denny Zhang