Note: setq seems to be unnecessary if PATH variable is modified as above to correct location for find and grep executables. (setq find-program "C: \\GNU \\gnuwin32 \\bin \\find.exe" (setenv "PATH" (concat "C: \\GNU \\gnuwin32 \\bin " (getenv "PATH"))) If you installed ‘GnuWin32’ under, say, “C:\GNU\gnuwin32”, consider adding the following commands to Emacs initialization file: ( when (or (eq system-type 'windows-nt) (eq system-type 'msdos)) It appears that you also need the LS command: FileUtils for Windows.You can obtain ‘grep’ and ‘find’ from the GnuWin32 project: Change this with your path to MSYS bin directory "c: \\Program Files \\Git \\usr \\bin " In recent git installations, using msys from git-bash (setenv "PATH" Change this with your path to MSYS bin directory "C: \\MinGW \\msys \\1.0 \\bin " emacs in order to tell Emacs to use these files over any other executables with the same name, including Windows’ own find utility: (setenv "PATH" To have a recent version of find and grep plus other GNU utilities such as egrep you can install. The find and grep utilities from GnuWin32 (below) are very old versions. Emacs will then use these files over any other executables with the same name, including Windows’ own find utility.Īlternatively, you can install grep and find in their default locations and then modify Emacs’ PATH variable (see below). CygWin – see cygwin-mount.el and setup-cygwin.elĬopy grep.exe and find.exe (as well as any necessary.There are several ways to get a working ‘grep’ and ‘find’ on MS Windows. AckĪck is a replacement for grep, written in Perl, with some powerful features. Hits from ‘M-x grep’ can be iterated through using ` C-x `’. Since it’s necessary, Emacs automatically includes -n – you need not type it. The -n, which makes ‘grep’ add line numbers to the output, is necessary to make the search results active, so that you can navigate to them in the ways mentioned above. When you hit ‘RET’ or click ‘mouse-2’ on one of the lines, the file is opened at the matching line. This lists all lines matching ‘setq’ in your Emacs InitFile, ~/.emacs, showing the filename and the line numbers. The Emacs command colors the output and makes found lines clickable: When you click a search hit, Emacs visits the target file at the occurrence.įor example, use ‘M-x grep’ with the following input – in this case, the regexp is a string literal, ‘setq’, and there is only one file to search, ~/.emacs. The Emacs ‘grep’ command lets you run the Unix or GNU/Linux ‘grep’ program, which searches files for lines that match a regular expression (regexp). This mean that you after using them can use the grep command to for example filter the output results, perhaps like this: grep -i -nH -e "eshell/" *.el | grep -v defun Emacs Grep One very convenient thing is that lgrep and rgrep share command argument history with grep. rgrep knows about version control systems so it can avoid searching its control directories. lgrep searches in the current directory and rgrep searches the current directory tree. You do not have to know the unix grep command (but if you know it you can use that knowledge too). They both prompt the user for what to search for in a convenient manner. With Emacs 22 and later comes the very easy to use yet powerful commands lgrep and rgrep. This page is about the Emacs ‘grep’ command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |