From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Steinar Bang Newsgroups: gmane.emacs.help Subject: Re: Working rgrep in windows emacs in 2024? (GNU emacs 29.1, windows 11 Enterprise) Date: Wed, 14 Feb 2024 09:26:27 +0100 Message-ID: References: <86v86spk7b.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6982"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 14 09:27:21 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1raAbx-0001bs-AX for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 14 Feb 2024 09:27:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raAbF-0002Kd-8Q; Wed, 14 Feb 2024 03:26:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raAbD-0002KF-7X for help-gnu-emacs@gnu.org; Wed, 14 Feb 2024 03:26:35 -0500 Original-Received: from schwantz.bang.priv.no ([95.217.129.251]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raAb9-0001NU-RH for help-gnu-emacs@gnu.org; Wed, 14 Feb 2024 03:26:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dod.no; s=sb; t=1707899187; bh=JPJhghE4I+9V5cG4NtlV3DnxT4QKSDkkyQWWYajEKLQ=; h=From:To:Subject:In-Reply-To:References:Date:From; b=DiMlAVhDCNKw6u0J0a/bb5deIEiTMQV1QJ7w3WA2ARKafYZwW5LLEDwNh1bfhkDV9 +vYNl6aNcXDK4p5bbwsErFw6znqAm7uH7uYVZiePtfT8lPBH5DME+ULxaBuYIh7/4v 2c0F+7n63VRPJEwaLv0kCVXr+ihqYtbzW/zFy2l4= Original-Received: from AAP-5CG32757DH (unknown [84.210.69.52]) by schwantz.bang.priv.no (Postfix) with ESMTPSA id CCE621F1 for ; Wed, 14 Feb 2024 08:26:27 +0000 (UTC) In-Reply-To: <86v86spk7b.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 13 Feb 2024 15:28:24 +0200") Received-SPF: none client-ip=95.217.129.251; envelope-from=sb@dod.no; helo=schwantz.bang.priv.no X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145938 Archived-At: >>>>> Eli Zaretskii : >> I've messed with setting the PATH environment variable (from my .emacs) >> (if windows-emacs >> (setenv "PATH" (concat "c:\\ProgramFiles\\ezwinports\\bin;C:\\ProgramFil= es\\GnuWin32\\bin;" (getenv "PATH")))) >> and I've tried adding to the exec-path >> (when windows-emacs >> (push "C:/ProgramFiles/GnuWin32/bin" exec-path) >> (push "c:/ProgramFiles/ezwinports/bin" exec-path)) > I don't do that because the directory with ports of GNU software, > including 'find' and 'grep', is on my system-wide PATH. I tried that now, by removing the above from .emacs, editing PATH for my user to put C:\ProgramFiles\ezwinports first. But that still failed -*- mode: grep; default-directory: "~/projects/altinn3/app-localtest/" = -*- Grep started at Wed Feb 14 08:47:34 =20=20=20=20 find -H . -type d "(" -path "*/SCCS" -o -path "*/RCS" -o -path "*/CVS" = -o -path "*/MCVS" -o -path "*/.src" -o -path "*/.svn" -o -path "*/.git" -o = -path "*/.hg" -o -path "*/.bzr" -o -path "*/_MTN" -o -path "*/_darcs" -o -p= ath "*/{arch}" -o -path "*/node_modules" -o -path "*/target" ")" -prune -o = ^"^!^" -type d "(" -name ".#*" -o -name "*.o" -o -name "*~" -o -name "*.bin= " -o -name "*.bak" -o -name "*.obj" -o -name "*.map" -o -name "*.ico" -o -n= ame "*.pif" -o -name "*.lnk" -o -name "*.a" -o -name "*.ln" -o -name "*.blg= " -o -name "*.bbl" -o -name "*.dll" -o -name "*.drv" -o -name "*.vxd" -o -n= ame "*.386" -o -name "*.elc" -o -name "*.lof" -o -name "*.glo" -o -name "*.= idx" -o -name "*.lot" -o -name "*.fmt" -o -name "*.tfm" -o -name "*.class" = -o -name "*.fas" -o -name "*.lib" -o -name "*.mem" -o -name "*.x86f" -o -na= me "*.sparcf" -o -name "*.dfsl" -o -name "*.pfsl" -o -name "*.d64fsl" -o -n= ame "*.p64fsl" -o -name "*.lx64fsl" -o -name "*.lx32fsl" -o -name "*.dx64fs= l" -o -name "*.dx32fsl" -o -name "*.fx64fsl" -o -name "*.fx32fsl" -o -name = "*.sx64fsl" -o -name "*.sx32fsl" -o -name "*.wx64fsl" -o -name "*.wx32fsl" = -o -name "*.fasl" -o -name "*.ufsl" -o -name "*.fsl" -o -name "*.dxl" -o -n= ame "*.lo" -o -name "*.la" -o -name "*.gmo" -o -name "*.mo" -o -name "*.toc= " -o -name "*.aux" -o -name "*.cp" -o -name "*.fn" -o -name "*.ky" -o -name= "*.pg" -o -name "*.tp" -o -name "*.vr" -o -name "*.cps" -o -name "*.fns" -= o -name "*.kys" -o -name "*.pgs" -o -name "*.tps" -o -name "*.vrs" -o -name= "*.pyc" -o -name "*.pyo" ")" -prune -o -type f "(" -iname "*.yml" ")" -ex= ec grep --color=3Dalways -n --null -e "LocalAppMode" "{}" NUL ";" FIND: Parameter format not correct Grep exited abnormally with code 2 at Wed Feb 14 08:47:34 Looking at the output from getenv it looks like the system setting for PATH comes before mine: C:\Program Files\PuTTY;C:\Program Files\Common Files\Oracle\Java\javapa= th;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Syste= m32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (= x86)\Pulse Secure\VC142.CRT\X64\;C:\Program Files (x86)\Pulse Secure\VC142.= CRT\X86\;C:\Program Files (x86)\Common Files\Pulse Secure\TNC Client Plugin= \;C:\Program Files\WindowsPowerShell\Scripts\HP.ClientScriptLibrary;C:\Prog= ram Files\Git\cmd;C:\Program Files\PuTTY\;C:\Program Files\Calibre2\;C:\Pro= gram Files\dotnet\;C:\Program Files\Rancher Desktop\resources\resources\win= 32\bin\;C:\Program Files\Rancher Desktop\resources\resources\linux\bin\;C:\= ProgramFiles\ezwinports;C:\Users\sb\AppData\Local\Microsoft\WindowsApps;C:\= Users\sb\apps\apache-maven-3.9.6\bin;C:\Users\sb\apps\bin;C:\Users\sb\.dotn= et\tools;C:\Users\sb\AppData\Local\Programs\Microsoft VS Code\bin; It could be that tried putting the settings in the emacs config to avoid messing with the system PATH setting...? Or that I was lacking privileges to change that? Both config settings (i.e. both setenv on the PATH, and push on exec-path) are from 2015, and the last one (push on exec-path) has a commit message starting with "Attempt at", so I've never had success here, I think. > Does Emacs find find.exe and grep.exe if you try it with > executable-find, like this: > M-: (executable-find "find") RET On emacs with .emacs config removed, and C:\ProgramFiles\ezwinports added to PATH: "c:/Windows/system32/find.exe" (so that's why it didn't work) On emacs without the PATH setting and the .emacs config in place: "c:/Windows/system32/find.exe" So the .emacs config doesn't work and probably never have. > M-: (executable-find "grep") RET On emacs with .emacs config removed, and C:\ProgramFiles\ezwinports added to PATH: "c:/Windows/system32/find.exe" So that was promising. On emacs without the PATH setting and the .emacs config in place: nil So, yeah, that has never worked. >> But neither of the above settings have ever given me a working rgrep. > Which means what? What do you see if you try invoking rgrep? Please > show everything you type at rgrep's prompts and the output and/or > error messages you get as result. Sorry about that! Forgot! Included above. But I guess that means that if I can put C:\ProgramFiles\ezwinports first in the SYSTEM PATH then rgrep in emacs should work? I'll try (somewhat locked down corporate machine, so it can sometimes be hard to find out what I am allowed and not allowed to do...). >> Ezwinports is Emacs maintainer Eli Zaretskii's old port of linux/unix >> command line tools to windows: >> https://www.gnu.org/software/emacs/manual/html_node/efaq-w32/EZWinPorts.= html >>=20 >> Do these still work for 64bit windows? > Yes. I use them every day on 64-bit Windows 11. Just a side note: the find was both a win64 and a win32 version, and I picked the win64 version. But the grep was just a win32 version. Does that matter/have any unforseen consequences?