2

I am working on windows xp

I stored emacs in usb

I want to carry the .emacs file as well as binary files

what I tried are

(setenv “HOME” (format "%s" (getenv "emacspath")))

(setenv “HOME” (format "%s/" (getenv "emacspath")))

It seems works if I eval-expression in emacs

After setenv, I could notice setting env is works well by (getenv "home")

but I put the (setenv "home" (format "%s/" (getenv "emacspath"))) in "site-start.el" file in "site-lisp" folder, starting emacs says "Symbol's value as variable is void: "HOME"

Any ideas?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
kim taeyun
  • 1,837
  • 2
  • 24
  • 49

3 Answers3

3

An easier way - just create a batch file on your USB drive where you can set all env variables you need. Then start emacs.exe from the batch.

For example if you want to run SBCL add the following lines to your batch

rem SBCL_HOME is required for SBCL
set SBCL_HOME=%utils%\Lisp\sbcl\1.0.29
set SBCL_RUN=%SBCL_HOME%\sbcl.exe
set SBCL_OPTIONS=--noinform
Oleg Pavliv
  • 20,462
  • 7
  • 59
  • 75
0

How about using default.el either as a symlink or as a simple elisp pinter to your file:

(load-file "/path/to/usb/.emacs")
Ross Patterson
  • 5,702
  • 20
  • 38
  • 1
    Unfortunately, Windows works with the terrible drive-letter mechanism, so this might fail if you put the drive in another port. –  Sep 11 '11 at 19:12
0

Add following code to a file (e.g. c:/.emacs).

;; This function must be at begin
(defun zxy-relocate-dotemacs ()
  "Relocate .emacs file"
  (interactive)
  (with-temp-buffer
    (let (print-level print-length)
      (insert (format "(load-file \"%s\")" load-file-name))
      (if (file-exists-p "~/.emacs")
          (message "[zxy] Don't need relocate .emacs file!")
        (progn
          (message "[zxy] Relocate .emacs file.")
          (write-file "~/.emacs"))))))
(zxy-relocate-dotemacs)
;; Your configuration here

Open emacs and M-x load-file c:/.emacs.

Then it will relocate .emacs to c:/.emacs.

I use this when I copy my emacs to a new computer.

More information please visit my blog abuot emacs. http://coordinate.sinaapp.com/?cat=3

coordinate
  • 15,224
  • 6
  • 24
  • 24