help-gnu-emacs
[Top][All Lists]
Advanced

[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: Lennart Borgman
Subject: Re: Retrieve a web page into buffer and insert some text into it.
Date: Wed, 28 Jul 2010 17:46:16 +0200

See the thread about getting the title of a web page.

On Wed, Jul 28, 2010 at 5:36 PM, ken <gebser@mousecar.com> wrote:
>
> How would I fetch a web page into a new buffer, then programmatically
> insert some text into it?  (Of course subsequently saving the buffer to
> a file may done interactively.)
>
> I know a little elisp, but not yet the polished programmer (as this
> nonfunctioning code shows):
>
> 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, properly html-coded.
>    (insert "\n<p>From: <a href=\"" url "\">" url "</a>\n </p>\n\n"))
>
>
>
>
> --
> Find research and analysis on US healthcare, health insurance,
> and health policy at: <http://healthpolicydaily.blogspot.com/>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]