From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Autoload from a web page? Date: Tue, 29 Dec 2009 15:05:28 -0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262178170 32480 80.91.229.12 (30 Dec 2009 13:02:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Dec 2009 13:02:50 +0000 (UTC) Cc: Emacs-Devel devel To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 30 14:02:42 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NPyCE-00077E-OY for ged-emacs-devel@m.gmane.org; Wed, 30 Dec 2009 14:02:39 +0100 Original-Received: from localhost ([127.0.0.1]:48513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPyCF-0000R3-DC for ged-emacs-devel@m.gmane.org; Wed, 30 Dec 2009 08:02:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NPyC6-0000NO-10 for emacs-devel@gnu.org; Wed, 30 Dec 2009 08:02:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NPyC1-0000Je-1L for emacs-devel@gnu.org; Wed, 30 Dec 2009 08:02:29 -0500 Original-Received: from [199.232.76.173] (port=59320 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPyC0-0000JK-Ox for emacs-devel@gnu.org; Wed, 30 Dec 2009 08:02:24 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:42914) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NPyBz-0002XT-Q5 for emacs-devel@gnu.org; Wed, 30 Dec 2009 08:02:24 -0500 Original-Received: from vpn-132-204-232-59.acd.umontreal.ca (vpn-132-204-232-59.acd.umontreal.ca [132.204.232.59]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id nBUD2IHL027675; Wed, 30 Dec 2009 08:02:19 -0500 Original-Received: by vpn-132-204-232-59.acd.umontreal.ca (Postfix, from userid 501) id CAFBD3D9FAC; Tue, 29 Dec 2009 15:05:28 -0200 (ARST) In-Reply-To: (Lennart Borgman's message of "Sat, 26 Dec 2009 03:55:09 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (darwin) X-NAI-Spam-Score: 0.5 X-NAI-Spam-Rules: 2 Rules triggered DATE_IN_PAST_12_24=0.5, RV3437=0 X-NAI-Spam-Level: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:119031 Archived-At: > Would it be possible to setup a function to download an elisp file > from a web page when called and then evaluate that file and call > itself again (with the old parameters), now with the new definition > from the web page? (url-handler-mode 1) (autoload 'foo-function "http://toto.bar/baz/foo.el") > Would it be possible to redefine `require' during this eval so that it > downloads required files from the same web site (if they are missing)? I think that using `autoload' this would only work if that URL is in your global load-path (probably not something you want) or if your remote "foo.el" is careful to temporarily add its (file-name-directory load-file-name) to the load-path (c.f. thread about loading files relative to the current file). Otherwise you might be able to do something like (defun foo-function (&rest args) (let ((load-path (append load-path '("http://toto.bar/baz/")))) (load "foo.el") ;; Here you might additionally want to check that foo-function ;; was redefined. (apply 'foo-function args))) Do it at your own risk. Using SSH (via Tramp) rather than HTTP (via url-handler-mode) might be preferable. Stefan PS: Of course this is completely untested and may bump into lacking features of url-handler-mode.