emacs - set path for grep - HOWTO?

View: New views
2 Messages — Rating Filter:   Alert me  

emacs - set path for grep - HOWTO?

by Erwin Panen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,

How do I set the correct variable(s) for my xemacs on a stick (using win
XP) so that it will find grep and other utils?
Here's how my dir struct looks:

usb-drive/home/emacs-23.1/
                |-----/gnuwin32/bin/
                                            |---grep.exe
                                            |---egrep.exe
                                            |---

This is what I've been trying to use in my .emacs file:
(fyi: %pdrive% is a variable proper to me using Pstart (menu on usb drive)
------------------------------------------------------
;; 26-09-09 setting for grep functionality under XP
;;(setq exec-path (append exec-path (list "~/gnuwin32/bin/grep.exe")))
;;(when (string-equal system-type "windows-nt")
;;  (progn
    ;; am not using cygwin
;;    (setenv "PATH"
;;    (concat
;;     "~/gnuwin32/bin" ":"
;;     )
;;    )
;;  (setq exec-path
;;      '(
;;    "%pdrive%/gnuwin32/bin"
;;    )
;;    )
;; ))
;;(add-to-list 'load-path "~/gnuwin32/bin")
;; (setenv "~/gnuwin32/bin")

; append
; (setq exec-path (append exec-path (list(expand-file-name
"%pdrive%/home/gnuwin32/bin"))))
; prepend
(setq exec-path (cons (expand-file-name "~/gnuwin32/bin") exec-path))
-----------------------------------------------------------------------------------

Alas, nothing seems to help emacs to find grep
Neither M-! ->Shell command:
nor M-x grep work and give:
-----------------------------------------------------------------------------------
'grep' is not recognized as an internal or external command,
operable program or batch file.

Thanks for your tips and suggestions,

Erwin





Re: emacs - set path for grep - HOWTO?

by Eli Zaretskii :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Date: Sun, 27 Sep 2009 01:08:13 +0200
> From: Erwin Panen <erwinpanen@...>
>
> How do I set the correct variable(s) for my xemacs on a stick (using win
> XP) so that it will find grep and other utils?
> Here's how my dir struct looks:
>
> usb-drive/home/emacs-23.1/
>                 |-----/gnuwin32/bin/
>                                             |---grep.exe
>                                             |---egrep.exe
>                                             |---
>
> This is what I've been trying to use in my .emacs file:
> (fyi: %pdrive% is a variable proper to me using Pstart (menu on usb drive)
> ------------------------------------------------------
> ;; 26-09-09 setting for grep functionality under XP
> ;;(setq exec-path (append exec-path (list "~/gnuwin32/bin/grep.exe")))
> ;;(when (string-equal system-type "windows-nt")
> ;;  (progn
>     ;; am not using cygwin
> ;;    (setenv "PATH"
> ;;    (concat
> ;;     "~/gnuwin32/bin" ":"
> ;;     )
> ;;    )
> ;;  (setq exec-path
> ;;      '(
> ;;    "%pdrive%/gnuwin32/bin"
> ;;    )
> ;;    )
> ;; ))
> ;;(add-to-list 'load-path "~/gnuwin32/bin")
> ;; (setenv "~/gnuwin32/bin")
>
> ; append
> ; (setq exec-path (append exec-path (list(expand-file-name
> "%pdrive%/home/gnuwin32/bin"))))
> ; prepend
> (setq exec-path (cons (expand-file-name "~/gnuwin32/bin") exec-path))
> -----------------------------------------------------------------------------------
>
> Alas, nothing seems to help emacs to find grep

Try using "$pdrive" instead of "%pdrive%".  Emacs uses the Unix
notation for environment variables, not the Windows notation.

Note that I didn't test my suggestion, so it might not work.  If it
doesn't, try using (getenv "pdrive") and concat it with the rest.