all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Remote .emacs
@ 2008-04-06 22:45 Paulo J. Matos
  2008-04-07  8:50 ` Tassilo Horn
  2008-04-08  1:27 ` Mike Mattie
  0 siblings, 2 replies; 7+ messages in thread
From: Paulo J. Matos @ 2008-04-06 22:45 UTC (permalink / raw)
  To: emacs list

Hello all,

I have several PCs I work regularly and where I regularly use emacs.
Each time I update one .emacs, I have to update the others so that all
are in sync.

I wonder if there's already some code to:
- Load a remote .emacs from the net.  If there's no remote access then
use the previous cached one. Otherwise load the one from the net and
cache it.
- I don't know much about emacs lisp but if there are ways through
emacs lisp to get files from http or ftp or something, it shouldn't be
hard to implement this as a library required by local .emacs and ran
each time the local .emacs is executed.

Cheers,

-- 
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK
Sponsor ECS runners - Action against Hunger:
http://www.justgiving.com/ecsrunslikethewind




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Remote .emacs
       [not found] <mailman.10084.1207521928.18990.help-gnu-emacs@gnu.org>
@ 2008-04-07  6:11 ` Niels Giesen
  2008-04-07  9:43   ` Paulo J. Matos
  2008-04-07 16:59   ` Tom Tromey
  0 siblings, 2 replies; 7+ messages in thread
From: Niels Giesen @ 2008-04-07  6:11 UTC (permalink / raw)
  To: help-gnu-emacs

"Paulo J. Matos" <pocm@soton.ac.uk> writes:

> Hello all,
>
> I have several PCs I work regularly and where I regularly use emacs.
> Each time I update one .emacs, I have to update the others so that all
> are in sync.
>
> I wonder if there's already some code to:
> - Load a remote .emacs from the net.  If there's no remote access then
> use the previous cached one. Otherwise load the one from the net and
> cache it.
> - I don't know much about emacs lisp but if there are ways through
> emacs lisp to get files from http or ftp or something, it shouldn't be
> hard to implement this as a library required by local .emacs and ran
> each time the local .emacs is executed.
>

How about something like this:

(defvar *cached-init-file* "~/cached-init.el")
(defvar *remote-init-file* "http://your/remote/.emacs")

(defun load-remote ()
  "Load remote .emacs.

This assumes your .emacs file starts with at least three comment
characters (;;;) in order to skip the header returned by 
the function `url-retrieve-synchronously'."
  (let ((content
         (save-excursion
           (let ((buffer (condition-case nil (url-retrieve-synchronously
                                 *remote-init-file*)
                           (error nil))))
             (when buffer
               (set-buffer buffer)
               (re-search-forward "^;;" nil t)
               (buffer-substring-no-properties (point) (point-max)))))))
    (cond (content
           (eval content)
           (with-temp-file *cached-init-file*
             (erase-buffer)
             (insert content)
             (eval-buffer)))
          (t (load-file *cached-init-file*)))))

(load-remote)

Does lead me to wonder: how can we check for an internet connection without
actually making a (failing) request?

> Cheers,
>
> -- 
> Paulo Jorge Matos - pocm at soton.ac.uk
> http://www.personal.soton.ac.uk/pocm
> PhD Student @ ECS
> University of Southampton, UK
> Sponsor ECS runners - Action against Hunger:
> http://www.justgiving.com/ecsrunslikethewind
>
>

-- 
http://niels.kicks-ass.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Remote .emacs
  2008-04-06 22:45 Paulo J. Matos
@ 2008-04-07  8:50 ` Tassilo Horn
  2008-04-07  9:44   ` Paulo J. Matos
  2008-04-08  1:27 ` Mike Mattie
  1 sibling, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2008-04-07  8:50 UTC (permalink / raw)
  To: help-gnu-emacs

"Paulo J. Matos" <pocm@soton.ac.uk> writes:

> - I don't know much about emacs lisp but if there are ways through
> emacs lisp to get files from http or ftp or something, it shouldn't be
> hard to implement this as a library required by local .emacs and ran
> each time the local .emacs is executed.

On all machines use a .emacs with these contents:

  (load-file "/paulo@paulos.server.net:/home/paulo/.emacs")

This requires TRAMP, which is included in emacs 22 AFAICT.

Of course, that won't do caching, but I leave that to you as an
exercise. ;-)

Hope that helps,
Tassilo





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Remote .emacs
  2008-04-07  6:11 ` Remote .emacs Niels Giesen
@ 2008-04-07  9:43   ` Paulo J. Matos
  2008-04-07 16:59   ` Tom Tromey
  1 sibling, 0 replies; 7+ messages in thread
From: Paulo J. Matos @ 2008-04-07  9:43 UTC (permalink / raw)
  To: Niels Giesen; +Cc: help-gnu-emacs

On Mon, Apr 7, 2008 at 7:11 AM, Niels Giesen <niels.giesen@gmail.com> wrote:
>  Does lead me to wonder: how can we check for an internet connection without
>  actually making a (failing) request?
>

That's great! Thank you, I definitely need to learn some Emacs Lisp.

-- 
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK
Sponsor ECS runners - Action against Hunger:
http://www.justgiving.com/ecsrunslikethewind




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Remote .emacs
  2008-04-07  8:50 ` Tassilo Horn
@ 2008-04-07  9:44   ` Paulo J. Matos
  0 siblings, 0 replies; 7+ messages in thread
From: Paulo J. Matos @ 2008-04-07  9:44 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

On Mon, Apr 7, 2008 at 9:50 AM, Tassilo Horn <tassilo@member.fsf.org> wrote:
> "Paulo J. Matos" <pocm@soton.ac.uk> writes:
>
>
> > - I don't know much about emacs lisp but if there are ways through
>  > emacs lisp to get files from http or ftp or something, it shouldn't be
>  > hard to implement this as a library required by local .emacs and ran
>  > each time the local .emacs is executed.
>
>  On all machines use a .emacs with these contents:
>
>   (load-file "/paulo@paulos.server.net:/home/paulo/.emacs")
>
>  This requires TRAMP, which is included in emacs 22 AFAICT.
>
>  Of course, that won't do caching, but I leave that to you as an
>  exercise. ;-)
>
>  Hope that helps,
>  Tassilo
>
>
>
>

Thanks! [Tassilo, Sorry for sending a message to you privately by mistake]

-- 
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK
Sponsor ECS runners - Action against Hunger:
http://www.justgiving.com/ecsrunslikethewind




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Remote .emacs
  2008-04-07  6:11 ` Remote .emacs Niels Giesen
  2008-04-07  9:43   ` Paulo J. Matos
@ 2008-04-07 16:59   ` Tom Tromey
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2008-04-07 16:59 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> "Niels" == Niels Giesen <niels.giesen@gmail.com> writes:

Niels> Does lead me to wonder: how can we check for an internet
Niels> connection without actually making a (failing) request?

I don't think there is a way.  I don't know of it anyhow.

On some systems you could get away with using the new dbus code to
contact NetworkManager and see if there is a connection.  I'm not sure
how to do this :-).  And, while this would work great for me, it
definitely wouldn't work for most users, I think.

Tom





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Remote .emacs
  2008-04-06 22:45 Paulo J. Matos
  2008-04-07  8:50 ` Tassilo Horn
@ 2008-04-08  1:27 ` Mike Mattie
  1 sibling, 0 replies; 7+ messages in thread
From: Mike Mattie @ 2008-04-08  1:27 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]

On Sun, 6 Apr 2008 23:45:25 +0100
"Paulo J. Matos" <pocm@soton.ac.uk> wrote:

> Hello all,
> 
> I have several PCs I work regularly and where I regularly use emacs.
> Each time I update one .emacs, I have to update the others so that all
> are in sync.
> 
> I wonder if there's already some code to:
> - Load a remote .emacs from the net.  If there's no remote access then
> use the previous cached one. Otherwise load the one from the net and
> cache it.
> - I don't know much about emacs lisp but if there are ways through
> emacs lisp to get files from http or ftp or something, it shouldn't be
> hard to implement this as a library required by local .emacs and ran
> each time the local .emacs is executed.

I keep my emacs setup and personal programming tools in a SubVersion repository.
I can synchronize them with 'svn update'. The third party libraries the configuration
relies upon is the real problem. I am now working with ELPA as a acceptable solution
to managing dependencies for a user-specific configuration.



 
> Cheers,
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-04-08  1:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.10084.1207521928.18990.help-gnu-emacs@gnu.org>
2008-04-07  6:11 ` Remote .emacs Niels Giesen
2008-04-07  9:43   ` Paulo J. Matos
2008-04-07 16:59   ` Tom Tromey
2008-04-06 22:45 Paulo J. Matos
2008-04-07  8:50 ` Tassilo Horn
2008-04-07  9:44   ` Paulo J. Matos
2008-04-08  1:27 ` Mike Mattie

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.