help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: emacs-home variable for Windows


From: Henri Fischer
Subject: Re: emacs-home variable for Windows
Date: Mon, 19 Oct 2009 04:58:04 -0700 (PDT)
User-agent: G2/1.0

On Oct 15, 3:03 am, "B. T. Raven" <ni...@nihilo.net> wrote:
> zugzwang wrote:
> > On Oct 14, 4:49 pm, "B. T. Raven" <ni...@nihilo.net> wrote:
> >> Lennart Borgman wrote:
> >>> On Wed, Oct 14, 2009 at 6:50 AM, B. T. Raven <ni...@nihilo.net> wrote:
> >>>> Lennart Borgman wrote:
> >>>>> On Wed, Oct 14, 2009 at 2:00 AM, ken <geb...@mousecar.com> wrote:
> >>>>>> I carry a USB stick to the job.  It's got emacs installed on it and
> >>>>>> there's a link on my desktop that I click (after inserting the stick)
> >>>>>> and emacs fires up.  It's nice.  I use it every day.  With the paucity
> >>>>>> of decent editors fromWindows, I *need* it.
> >>>>>> There's a couple minor hassles though that I'd like to dispense with.
> >>>>>> One is that I don't know a way to tell emacs what the HOME directory 
> >>>>>> is.
> >>>>>>  In the past I've just gone into the registry and change somevariable
> >>>>>> there.  I don't remember where that is or how to do it though.  
> >>>>>> Besides,
> >>>>>> I prefer to have thevariabledefined in my .emacs (which is at the
> >>>>>> top-level directory on the USB stick).  (After emacs loads, I do "M-x
> >>>>>> loadfile RETURN e:/.emacs" and that little task loads up the rest of 
> >>>>>> the
> >>>>>> stuff emacs needs to know.  But I don't know how tell emacs to make e:/
> >>>>>> the home directory.
> >>>>> There is a library usb-setup.el in Emacs+EmacsW32 for this.
> >>>> Can this .el file be downloaded separately from EmacsW32 to use with the
> >>>> standard Emacs w32 build? Is it somewhere in nXhtml 1.97 or has it been
> >>>> removed?
> >>> No, at the moment it is only in Emacs+EmacsW32 and I have not had time
> >>> to setup a repository for that.
> >>> However all that file does is to use the ideas from
> >>>  http://at-aka.blogspot.com/2006/06/portable-emacs-22050-on-usb.html
> >>> and reorganises them a bit. So just look there instead.
> >> Thanks, Lennart. I almost understand the stuff at that link but I can't
> >> see how thevariable'data-directory refers to the right drive letter
> >> until after Emacs is launched from the flash drive. The drive letter
> >> could be G:\ when plugged in today and H:\ tomorrow.
>
> >> With GnuW32 utils I got as far as producing:
>
> >> df -a | tail -1 > usbemacs.bat
>
> >> with the result:
>
> >> STORE N GO             4021232   1850100   2171132  47% G:\
>
> >> I am at a loss as to where I should go from here.
>
> >> Thanks again,
>
> >> Ed
>
> > I've never used emacs, and my Dos batch-writing skills are rusty, so
> > all I can offer is a conceptual solution.  Presumably, your emacs
> > distribution contains a directory not found on any other drive (e.g.
> > <drive_letter>:\MyEmacsDir\).  Any unique path will do.  Simply have
> > the desk icon start a batch file that begins as follows:
>
> > dir C:\MyEmacsDir\
> > If error: directory not exist, continue : else set variable_1 to 'C'
> > and then goto Label_1:
>
> > dir D:\MyEmacsDir\
> > If error: directory not exist, continue : else set variable_1 to 'D'
> > and then goto Label_1:
>
> > dir E:\MyEmacsDir\
> > If error: directory not exist, continue : else set variable_1 to 'E'
> > and then goto Label_1:
>
> > ...
>
> > Label_1:
> > set <Emacs_Home> to %variable_1%<desired_path>
> > execute %variable_1%:\<desired path_name + executable file_name>
>
> Thanks "forced move." ;-) Newer batch commands allow:
>
> If exist e:\emacs set HOME e:\
>
> but I want to set it to the drive letter of the last device plugged into
> a usb port.

To make sure home is on my USB I have the following in site-
lisp>subdirs.el:

(if (and invocation-directory
   (eq (string-match "[a-zA-Z]:" invocation-directory) 0))
  (let ((drive (substring invocation-directory 0 1)))
    (setenv "HOME" (concat drive ":/home"))))

Henri


reply via email to

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