emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Autoload from a web page?


From: Stefan Monnier
Subject: Re: Autoload from a web page?
Date: Tue, 29 Dec 2009 15:05:28 -0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (darwin)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]