From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Retrieve a web page into buffer and insert some text into it. Date: Wed, 28 Jul 2010 11:36:19 -0400 Message-ID: <4C504E73.6050207@mousecar.com> Reply-To: gebser@mousecar.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1280331459 17417 80.91.229.12 (28 Jul 2010 15:37:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 28 Jul 2010 15:37:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 28 17:37:36 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Oe8hL-0001cQ-1L for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jul 2010 17:37:35 +0200 Original-Received: from localhost ([127.0.0.1]:50076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oe8hJ-0004vg-Bo for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jul 2010 11:37:33 -0400 Original-Received: from [140.186.70.92] (port=39513 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oe8gV-0004nr-Hp for help-gnu-emacs@gnu.org; Wed, 28 Jul 2010 11:36:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oe8gS-0001HQ-2g for help-gnu-emacs@gnu.org; Wed, 28 Jul 2010 11:36:40 -0400 Original-Received: from mout.perfora.net ([74.208.4.195]:63711) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oe8gR-0001H0-T3 for help-gnu-emacs@gnu.org; Wed, 28 Jul 2010 11:36:40 -0400 Original-Received: from dellap.mousecar.net (dsl093-011-017.cle1.dsl.speakeasy.net [66.93.11.17]) by mrelay.perfora.net (node=mrus4) with ESMTP (Nemesis) id 0MarVy-1OPD8E1X7S-00K0h0; Wed, 28 Jul 2010 11:36:38 -0400 User-Agent: Thunderbird 2.0.0.24 (X11/20100721) X-Enigmail-Version: 0.96.0 OpenPGP: id=5AD091E7 X-Provags-ID: V02:K0:BctJGJJssSWHWzJ73yFcS4VNlJ7hNhohn2Fw2th9D8a NkQldpwbktNWFdHR8wDjTNtAvdZN1sVP5Qq4kL2j2pW8xP37KQ pNYKF2UKI5KMrOlzn0UdtD1I1sjw0toymvn9uS+1aKdt4qEWzq U5HbVBn+kNFKuPrlxjsmnfvkILOts2lCQSPlMBjqHsYrRyQVhM 2JN0sh0FuZkrw1qnoVIYdMe2kRIY2qtX78591PIw+c= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:74321 Archived-At: 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 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 "" nil t) ;go to end of tag. ;insert URL into page, properly html-coded. (insert "\n

From: " url "\n

\n\n")) -- Find research and analysis on US healthcare, health insurance, and health policy at: