Portable Emacs 22.0.50 on USB

Here, I'll give you a small descripiton to put NTEmacs (Emacs on Windows) into your USB flash memory! You can bring your Emacs anywhere ;) Only you need is USB flash memory 256+ MB.

emacs+auctex by Ralf Angeli

Ralf Angeli, one of the main developpers of AUCTeX, compiles the latest Emacs CVS with AUCTeX bundle for Windows. I call this distribution emacs+auctex for windows. emacs+auctex is available at

The latest version of emacs+auctex is checked out and packaged on 2006-06-24. Read the Release note for details.

The file emacs+auctex-w32-<date>.zip includes the pre-compiled package while emacs+auctex-src-<date>.zip holds the source code and build instructions in case you want to look at it or compile it yourself.


For installing the package, simply unpack emacs+auctex-w32-<date>.zip at the desired location. Then, copy the directory emacs+auctex-w32-<date> into your USB flash memory. It takes some minutes to copy all the files because emacs+auctex is very big package.

You can start Emacs by executing runemacs.exe in the bin subdirectory.

.emacs and site-lisp customization

Emacs for Windows looks for your .emacs file in c:/Document and Setting/USERNAME by default. But USB application must find its init files in the USB memony.

Here the tips!

Put the following codes into f:/emacs+auctex-w32-<date>/Emacs/site-lisp/site-start.el.

(defvar usb-drive-letter (substring data-directory 0 3))
(defvar usb-home-dir (concat usb-drive-letter "home/"))

(setenv "HOME" usb-home-dir)

In this section, I use f: for the drive letter of USB flash memory. But please remmember that the drive letter will be changed by each of machines. Do not write the drive letter directly to your init files. Use the variable usb-drive-letter for the drive letter.

Now make directory home in f:/. This is the simple .emacs file in f:/home/

;; Portable Emacs init file.

(setq user-full-name "YOUR NAME")
(setq user-mail-address "YOUR EMAIL ADDRESS")

;; Set environment
(defvar usb-site-lisp-dir (expand-file-name "site-lisp" usb-home-dir))
(setq load-path (cons usb-site-lisp-dir load-path))
(let ((dir (delete nil (mapcar (lambda (f)
     (unless (string-match "\\.elc?\\'" f) f))
          (cddr (directory-files usb-site-lisp-dir t))))))
  (setq load-path (append dir load-path)))

Additional Elisp files should be saved in f:/home/site-lisp/.

Update emacs+auctex

Just remove old emacs+auctex directory, and copy new one into USB flash memory.

Then put above codes for site-start.el into new site-start.el.


Thanks go to Ralf Angeli and AUCTeX develop members!


  1. Thanks a million...

    I just followed your instructions because I really wanted to use emacs at work, but they won't let me download it...

    Good luck...

  2. I'm very happy to hear that my article helped your Emacs life! Have fun!!

  3. I also say:

    Thank you very much!



  4. Hi

    I dont know if this is relevant to this post. But I had some problem like the one above and i solved it with inspiration from this post.

    My problem was that I had emacs portable + miktex portable, and I couldn't get them to work together. I found out that if I went to site-start.el and added

    (setenv "PATH" (concat usb-drive-letter "MiKTeXPortable/miktex/bin/"))

    to site-start.el, where "MiKTeXPortable" refers to the directory I had miktex portable installed, then Emacs was able to compile my latex documents using my portable miktex.

    I thought I would post my solution somewhere since I didn't find any myself.

    And thanks for the post.


  5. Thank you for your comment.
    Your idea is good solution for that problem.

    You should post your idea in some blog or some so. That's good!

  6. It has not worked for me however, :(
    I've checked every single character & line but unsuccessful, if any help? I'd appreciate.

  7. Oh, I've found wrong sample code.
    I fixed it. Try sample code again, please.