I’ve been messing with Cygwin lately– so far mainly to grep source code files from multiple projects without having to load them up into irritating bloated IDE sessions to run Find GUI’s that operate with small counter-intuitive differences. It’s handy to be able to dump the output into a text-file like this:
grep -i your_pattern_here */*.* > FileName.txt
The above command searches all of files one level down from the current directory and ignores case– and dumps the results into FileName.txt. Thanks to a Blasphemous Bit from Bob McCormick, I’ve been using Rxvt lately, so I have a much better terminal than that crusty old MS-DOG cmd screen. Lots of “real estate” now. A nice small font. Lots less scrolling. Yes indeed, we now have Cygwin Nirvana.
Imagine my surprise when emacs won’t open my text file:
emacs: Cannot connect to X server :0.
Check the DISPLAY environment variable or use `-d’.
Also use the `xhost’ program to verify that it is set to permit
connections from your machine.
After googling a dozen web pages, running man a few times, and experimenting with various DISPLAY settings, I discovered that all I really needed to do was open emacs with the -nw option.
emacs -nw FileName.txt
Emacs had gotten “broken” in Rxvt after I downloaded a bunch of new programs for Cygwin, so I don’t know for sure what it was that triggered the problem. (It is nice having all of that extra real estate to work with in that terminal mode, but I haven’t gotten around to figuring out how to run Slime and Lisp from there, yet.)
Oh, here’s a few of bonus Unix tips just for you:
If you want to see all of your environment variables, type printenv.
If you’re reading a man page and want to do more than just keep hitting the space bar… try hitting Ctrl-v and Alt-v to page up and page down. If you just want it to go away, try typing Ctrl-z. (Hmm… I wonder how many other Emacs commands work here…?)
If you are moving through directories looking for a file and you can’t tell the difference between your files and your directories because they all show up the same color or whatever… then you can use the cd command to help tell them apart. You probably already use the tab key to auto-complete your folder names while changing directories. Well… if you hit tab when a folder name is already typed out the whole way, then a directory gets printed out with all of the folders marked with a / at the end of their names. Rock on with your bad Unix self!
Ah well… don’t let any cryptic error messages ruin your morning!