From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.help Subject: Re: Retrieve a web page into buffer and insert some text into it. Date: Wed, 28 Jul 2010 17:46:16 +0200 Message-ID: References: <4C504E73.6050207@mousecar.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1280332025 19698 80.91.229.12 (28 Jul 2010 15:47:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 28 Jul 2010 15:47:05 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: gebser@mousecar.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 28 17:47:02 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 1Oe8qU-0006WB-7t for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jul 2010 17:47:02 +0200 Original-Received: from localhost ([127.0.0.1]:50706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oe8qT-0001FA-Ly for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jul 2010 11:47:01 -0400 Original-Received: from [140.186.70.92] (port=55256 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oe8q6-0001EG-81 for help-gnu-emacs@gnu.org; Wed, 28 Jul 2010 11:46:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oe8q5-0002qQ-3I for help-gnu-emacs@gnu.org; Wed, 28 Jul 2010 11:46:38 -0400 Original-Received: from mail-qw0-f41.google.com ([209.85.216.41]:54131) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oe8q4-0002qL-V5 for help-gnu-emacs@gnu.org; Wed, 28 Jul 2010 11:46:37 -0400 Original-Received: by qwk4 with SMTP id 4so1105490qwk.0 for ; Wed, 28 Jul 2010 08:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=gpPmwKOUBGZ7csinTixzDTVEN8mEJw4cp50E5i59pwk=; b=ZlQb1P7WtDRsR613MzNUhE6iPhF2AA+jJ2Xh5XsiYi5QGW0hSAmSAyNsxH2iQvZttw UbfYHlXF/7RLsKFVMY/cnC4lII4jK/9gE6Rq+rHgYjS3T40Ipa532FRAhFu04E+yg7TR xfn6PVsdkzDUd1EgKW9qU2vzNBtvh6opCfiF4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=KrkTUscg2WB5mydkjx20L5rJYyPklcS1ec4UcHX1IJbvvH8PPTgKwuYdFuVJcJu2wS lUI6jvieu1xHUsXeToBJJkTmOtEEs6Ix9GI/7mJblwRe0Uz3/D8MzvR1r40EvdUmuHjG fPI8RCobyMPBjvhTDhYWyVBRLNoTMB6BcfjoA= Original-Received: by 10.224.95.159 with SMTP id d31mr9024534qan.146.1280331996310; Wed, 28 Jul 2010 08:46:36 -0700 (PDT) Original-Received: by 10.229.5.72 with HTTP; Wed, 28 Jul 2010 08:46:16 -0700 (PDT) In-Reply-To: <4C504E73.6050207@mousecar.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:74323 Archived-At: See the thread about getting the title of a web page. On Wed, Jul 28, 2010 at 5:36 PM, ken wrote: > > How would I fetch a web page into a new buffer, then programmatically > insert some text into it? =C2=A0(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) > =C2=A0"Retrieve web page and load into new buffer for editing. > Automatically insert after tag URL, appropriately html-tagged URL.= " > =C2=A0(interactive "sLoad URL: " > =C2=A0(with-temp-buffer (url-retrieve url edit-web-page)))) > > > (defun edit-web-page (status) > =C2=A0 =C2=A0 =C2=A0"Switch to the buffer returned by `url-retreive'. > =C2=A0 =C2=A0The buffer should contain the web page sent by the server." > =C2=A0 =C2=A0 =C2=A0(switch-to-buffer (current-buffer)) > =C2=A0 =C2=A0(goto-char 0) > =C2=A0 =C2=A0(re-search-forward "" nil t) ;go to end of tag. > =C2=A0 =C2=A0;insert URL into page, properly html-coded. > =C2=A0 =C2=A0(insert "\n

From: " url "\n

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