Subject: Re: 25.0.93; dired-do-find-regexp does not work on Windows even after installing GNU find and grep

From: Kaushal Modi <[email-masked]>
Date: Thu, 05 May 2016 16:36:00 +0000

>
> > I do not have admin access (work computer). Wouldn't (setenv "PATH"
> "..") be the same?
>
> No.
>

But the fact that I am able to do so says otherwise. I removed the path
customization from both user and system PATH values (I had got temp admin
rights to update the system PATH in Windows), added the below to my config
and now find/grep work beautifully.

  (let ((ezwinports-path "C:/Users/kmodi/Dropbox/Portable
Software/ezwinports/bin"))
      (setq exec-path (add-to-list 'exec-path ezwinports-path))
      (setenv "PATH" (concat (replace-regexp-in-string
                              "/" "\\\\" ezwinports-path) ";"
                              (getenv "PATH"))))

> If I rename the MS find.exe (which I cannot without admin aceess), will
> it not affect any other program using it?
>
> Nothing uses it.
>

I wasn't aware of that, thanks.

> As I mentioned, I also set the PATH using (setenv "PATH "..."). Isn't
> executable-find returning the correct
> > find.exe and grep.exe a proof that the right executable is being found.
>
> No.  See the source of executable-find.
>

OK, but I am able to reference to the chrome, find, grep binaryies
correctly using only the tweaks to exeec-path and PATH from within emacs. I
do not need to change it in Windows settings.

As executable-find uses exec-path, I think that manipulating just that
suffices for applications like chrome and firefox that are not executed
from shell (unlike find and grep). I am saying this from what I practically
see on my Windows machine.

> > I have had this in my config and it works fine (for a different
> executable chrome.exe):
> >
> > (let ((chrome-path "C:/Program Files (x86)/Google/Chrome/Application/"))
> > (setq exec-path (append exec-path `(,chrome-path)))
> > (setq browse-url-generic-program (executable-find "chrome")))
>
> Bad idea, as I explained in my earlier message.  You need to change
> PATH _outside_ of Emacs.
>

Well, as mentioned earlier, changing the exec-path and doing setenv PATH
from within emacs works just fine.

In summary I have this in my Windows emacs config and it works great
without needing external PATH manipulation.

=====
(let ((firefox-path "C:/Users/kmodi/AppData/Local/Mozilla Firefox/"))
      (setq exec-path (append exec-path `(,firefox-path))))

    (let ((chrome-path "C:/Program Files (x86)/Google/Chrome/Application/"))
      (setq exec-path (append exec-path `(,chrome-path)))
      (setq browse-url-generic-program (executable-find "chrome")))

    (let ((ezwinports-path "C:/Users/kmodi/Dropbox/Portable
Software/ezwinports/bin"))
      (setq exec-path (add-to-list 'exec-path ezwinports-path))
      (setenv "PATH" (concat (replace-regexp-in-string "/" "\\\\"
ezwinports-path)
                             ";" (getenv "PATH"))))
=====
-- 

-- 
Kaushal Modi