[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Retrieve a web page into buffer and insert some text into it.
From: |
ken |
Subject: |
Re: Retrieve a web page into buffer and insert some text into it. |
Date: |
Thu, 29 Jul 2010 16:01:24 -0400 |
User-agent: |
Thunderbird 2.0.0.24 (X11/20100721) |
On 07/29/2010 11:22 AM filebat Mark wrote:
> Hi Ken
Hi, Denny. Thanks for replying
> Where do you set the value of url in the second function?
It needs to be passed from the first defun, but I don't know the syntax
for doing that. The url-retrieve function is a little complex in terms
of its arguments. I think it's stumped even the experts on this list.
> One big enhancement shall be setting the coding system of the temp
> buffer, based on the charset of the html page.
Thanks for bringing that up. Yeah, I followed that on your thread. I
might have to deal with that too. If, after I get the main part of my
code working how I want it, I find it's having that problem, I'll review
your emails (which I still have) and perhaps get back to you for some tips.
> Regards,
> Denny
Back at ya!
ken
>
> On Thu, Jul 29, 2010 at 7:46 AM, ken <gebser@mousecar.com
> <mailto: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
>
- Retrieve a web page into buffer and insert some text into it., ken, 2010/07/28
- Re: Retrieve a web page into buffer and insert some text into it., Lennart Borgman, 2010/07/28
- Re: Retrieve a web page into buffer and insert some text into it., ken, 2010/07/28
- Re: Retrieve a web page into buffer and insert some text into it., filebat Mark, 2010/07/29
- Re: Retrieve a web page into buffer and insert some text into it.,
ken <=
- Message not available
- Re: Retrieve a web page into buffer and insert some text into it., ken, 2010/07/30
- Re: Retrieve a web page into buffer and insert some text into it., filebat Mark, 2010/07/30
- Re: Retrieve a web page into buffer and insert some text into it., filebat Mark, 2010/07/30
- Re: Retrieve a web page into buffer and insert some text into it., filebat Mark, 2010/07/30
- Re: Retrieve a web page into buffer and insert some text into it., Teemu Likonen, 2010/07/30
- Re: Retrieve a web page into buffer and insert some text into it., filebat Mark, 2010/07/30