From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Re: Retrieve a web page into buffer and insert some text into it. Date: Thu, 29 Jul 2010 16:01:24 -0400 Message-ID: <4C51DE14.2060102@mousecar.com> References: <4C504E73.6050207@mousecar.com> <4C50C15D.6000808@mousecar.com> Reply-To: gebser@mousecar.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1280433754 23476 80.91.229.12 (29 Jul 2010 20:02:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 29 Jul 2010 20:02:34 +0000 (UTC) To: GNU Emacs List Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 29 22:02:32 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 1OeZJH-0001O1-97 for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Jul 2010 22:02:31 +0200 Original-Received: from localhost ([127.0.0.1]:42055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeZJG-0005nP-8m for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Jul 2010 16:02:30 -0400 Original-Received: from [140.186.70.92] (port=58183 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeZIn-0005m4-Ed for help-gnu-emacs@gnu.org; Thu, 29 Jul 2010 16:02:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OeZIl-0005lM-Mi for help-gnu-emacs@gnu.org; Thu, 29 Jul 2010 16:02:01 -0400 Original-Received: from mout.perfora.net ([74.208.4.195]:50018) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeZIl-0005l8-Hw for help-gnu-emacs@gnu.org; Thu, 29 Jul 2010 16:01:59 -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 0LmbBD-1PDu3G26hH-00ZUSu; Thu, 29 Jul 2010 16:01:56 -0400 User-Agent: Thunderbird 2.0.0.24 (X11/20100721) In-Reply-To: X-Enigmail-Version: 0.96.0 OpenPGP: id=5AD091E7 X-Provags-ID: V02:K0:jZaipfwTvHboQIaF+johGNSx91AUTdt9W+352CfDp30 eYuN6yocfczWnnLaKoZDGqdIaCLPkGLQIyiubrZ3Gv9RagnrRi +hMtU8EkpNyt4dl0YolmefdQbwpMfRXXlx4VEZMUkMFAm1OQ4f AtafzUAjal+WtDnUnRzjhPeMCQJdC8ZgQxTU4iG+ilvywUE+jo aCprEIa+gI9X8umxdLWwK41wqPU1/zd2+SwScaOLao= 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:74345 Archived-At: 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 > 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 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 > (insert "\n

From: " url "\n

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