all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Retrieve a web page into buffer and insert some text into it.
@ 2010-07-28 15:36 ken
  2010-07-28 15:46 ` Lennart Borgman
  2010-07-28 23:46 ` ken
  0 siblings, 2 replies; 11+ messages in thread
From: ken @ 2010-07-28 15:36 UTC (permalink / raw
  To: help-gnu-emacs


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/>



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

end of thread, other threads:[~2010-07-31  2:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28 15:36 Retrieve a web page into buffer and insert some text into it ken
2010-07-28 15:46 ` Lennart Borgman
2010-07-28 23:46 ` ken
2010-07-29 15:22   ` filebat Mark
2010-07-29 20:01     ` ken
     [not found]       ` <AANLkTi=7Y3=H1CeY_OvKZWwZp4R1JwpJCJQ20OMHTEKu@mail.gmail.com>
2010-07-30 11:23         ` ken
2010-07-30 16:32           ` filebat Mark
2010-07-30 16:51             ` filebat Mark
2010-07-30 17:00               ` filebat Mark
2010-07-30 17:12               ` Teemu Likonen
2010-07-31  2:05                 ` filebat Mark

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.