Question

I am successfully running Emacs from a portable drive (USB stick) but when I try to use diff functions I run into trouble. I've installed cygwin and it works with Emacs when I add the path to diff.exe to the environmental variable PATH in Windows. The problem is that with that approach I have to edit the environmental variables on every computer I'd like to use. No good.

Then I tried to add it to the path variable from within my site-start.el. The path is added when i examine the variable from within Emacs but still Emacs can't find the diff tool.

Does anyone have any ideas how to solve this?

Thanks in advance

-- Martin

Edit: My site-lisp.el looks like this now and nothing has worked so far (except for adding the path manually to the PATH environmental variable):

;
; Get drive letter
;
(defvar usb-drive-letter (substring data-directory 0 2)) 

;
; Add cygwin-folder to path and exec-path
;
(defvar cygwin-folder (concat usb-drive-letter "/PortableApps/CygwinPortable/App/Cygwin/bin/"))
(setenv "PATH" (concat (getenv "PATH") ";" cygwin-folder))
(setq exec-path (append exec-path cygwin-folder))

My folders are as follows:

[root of usb stick]
\PortableApps\Emacs\bin  (including runemacs.exe)
\PortableApps\CygwinPortable\App\Cygwin\bin   (including diff.exe)
Was it helpful?

Solution 4

I ended up moving diff.exe to the Emacs bin-folder instead. Nothing else I've found is working. Now my only problem is the bloody nodosfilewarning variable to stop cygwin complain on my ms-dos paths...

Cheers

OTHER TIPS

Which "path variable" are you setting? IIUC you want to set the exec-path Lisp variable (you probably also want to set the PATH environment variable, but that one will not affect Emacs's search for executables, it is only passed down to sub-processes).

try:
(setenv "PATH" (concat "d:/path/to/bin;" (getenv "PATH")))
note the path separator should be ; instead of : under windows

You might try pointing explicitly to the diff command by setting the variable 'diff-command' with the full path.

(setq diff-command "full/path/to/diff.exe")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top