Monday, January 30, 2006

I was a vim user. But i always wanted to switch to emacs. I ve heard that vim can do whatever emacs can. Anyway .. after i started exploring lisp, i heard from lisp community that how good emacs was. So i bought "Learning GNU Emacs" in the hope that one day i will learn it. I use command prompt (windows) quite often in my office. One thing that bothered me was running so many command prompts and switching between those. So for all those ppl who suffer these things, im going to write how to use emacs. Start using it. Get the installation from here (windows).After extracting, run addpm.exe from bin.

Opening a file - C-x C-fA prompt comes below (near status bar) asking for file. you can use TAB for navigating directories or files.Quitting a Command - C-gOften you start typing some command and want to quit (ie escaping .. note ESC doesnt work that way). Use this.For eg. you wanted to open file and did C-x but but you want to cancel it. do a C-gQuitting emacs - C-x C-cSaving a file - C-x sSaving to another file (Save As) - C-x C-wSaving all opened files (see buffers) - C-x C-sWindows CommandsEmacs can open many windows inside it. Often it happens that some command or command completion opens a new window and your window splits. This will be annoying in the beginning. Use the commands below to navigate windows.

Going to other window - C-x oMaximizing current window (current means where cursor is) - C-x 1Splitting current window - C-x 2Note that if you open new file after this, file will be opened in that window.Splitting current window Vertically - C-x 3See that C-x 2 opens window horizontally. Also you can use this and previous command inside a subwindow also.

BuffersBuffers represent all the open files and buffers not connected to files ;). If you are using the GUI version, you can see the buffers in the menubar. You can switch to the buffers from there.Going to another Buffer - C-x bPress enter. This will go to the previously used bufferListing Buffers - C-x C-b (see the difference between previous and this command. In previous you needed to release Ctrl after x was pressed, and in this you need to use Ctrl for both x and b)This will open another window listing all the buffers. To move to that window use C-x o, or use mouse. You can navigate through lines using 'n' and 'p' (next and previous .. You can use C-n instead of downarrow or C-p instead of uparrow. In Buffer List you need not use C-n, instead you can use n itself .. similarly for p). To select any buffer you can press '1'. This will make that buffer in a maximized window.There are some other useful things to do in this buffer list. Like if you want to delete some buffers press 'd'. A 'D' will come next to that buffer. To undo anything press 'u'. Finally to execute these press x.

Up Arrow alternative - C-pDown Arrow alternative - C-nLeft Arrow alternative - C-bRight Arrow alternative - C-f(i suggest to use these once you get comfortable with emacs, otherwise all these will garble your brain)Refreshing screen with current line in middle - C-l

Moving to start of line - C-aMoving to end of line - C-eMoving to start of file - M-< Moving to end of file - M-> (use shift key for '')Selecting some text (for copying or deleting).Use C-space for setting a mark. Use arrow keys (or alternatives) to move to the location till you want the text to be selected. (By default it will not show selected region highlighted. See using .emacs file (below) to how to change the behaviour)

Once you have selected your text use below commands for copying, pasting etcCopying Text - M-wCutting Text - C-wNote that C and M (ctrl and alt) have many similarities in commandsPasting Text - C-y (this is called yanking. in vim teminology yank means copy, but here it means paste)Undo - C-/ or C-x u

Running any command - M-xI heard you can run any command using this. Type M-x and press TAB to see various commands. One example would be killing current buffer by M-x kill-buffer. Renaming buffer by M-x rename-buffer

Running command prompt or shell - M-x shellenjoy. you can rename the shell to some other thing using M-x rename-buffer, and open as many shells as you canPrevious/Next commands in shell - M-p and M-n

Telnet - windows telnet doesnt work in shell. You need to dowload say jtelnet(a java app). put the jar in CLASSPATH, and runjava thor.app.tenet.One good thing is autocompletion of directory/files work probably because in shell..emacs file In *nix .emacs resides in your home. in windows if you do a default installation, i think it takes from C:\. See the windows installation faq. Note that in windows it is named _emacs not .emacs (windows wont allow you to). You can highlight the selected region by appending this in your emacs file (transient-mark-mode t) You can use syntax highlighting always by using (cond ((fboundp 'global-font-lock-mode) (global-font-lock-mode t) (setq font-lock-maximum-decoration t)))

Im a little bit tired now (no breakfast and lunch) .. if you want anything else do comment, i will update

Wednesday, January 25, 2006

After all the comfort i had, im finally moving out of campus. New project, new manager, new place, new everything. I'll be moving to nearby location where neo was earlier.. slightly depressing. Since its last day in campus, we went outside for lunch. It was a good restaurant .. we had crab, squid, prawns and whatnot .. quite a feast.

Its a good four day weekend coming .. and am planning to watch the videos (around 10GB of divx) of sicp (book is available online). If you are a computer science student, do watch/read it. This is what they teach in MIT

Friday, January 20, 2006

Occasionally i go through python dev mailing list for interesting things. Today i came across this where Guido says>> FYI: Real libreadline is GPL, and rms made a point of forcing>> (Aladdin-licensed) Ghostscript to remove stanzas from the Makefile>> that allowed linking to it as a user option. Ie, this particular pain>> in the neck is deliberate FSF policy, to encourage use of the GPL.

>Can we just all agree that RMS is an asshole now? Bah.

I respect both RMS and Guido and its funny how Guido doesnt like RMS. Another one here"Citing RMS's insanity is a great way to get my blood steaming." --GvR

Long before when ppl where using Tcl as glue language, RMS wanted to get a real language(he didnt like Tcl), Python was suggested. I think it was dropped as it was not under GPL. They set out to write Guile. I wonder where python would have been if it was chosen ..

Thursday, January 19, 2006

Last week my original intention was to watch the movie Zinda, which ended up with collectivechaos. I felt the need even more so me and my friend sneaked out of the office yesterday at 3:30 to watch Zinda. nowrunning showed the move time as 4:40pm in PVR. We reached PVR only to find out that it had already started at 4:10. Since the website usually doesnt go wrong, we checked other classes and needless to say, it was there in gold class. The tickets in gold class will cost you 500Rs. We felt dumb to leave after all these efforts and decided to watch it from gold class. Out of the 500, you can claim 150 for food (i bought a 150Rs chicken roll .. wonder there was any chicken in it). The seat was great with buttons to adjust the positioning. You can make it a bed .. anything.

Coming to the movie .. well it was good. I always like dull colored movies ;). John Abraham was great.. and so was his hair. I remembered seeing a particular fight sequence in some movie (i think Zeus got it sometime back) .. and yes it seems Zinda is a ripoff of oldboy. Anyway good going Sanjay Gupta.

updtate:My friend forwarded me an article on rediff What i want say to these kind of people is just to shut the fuck up. If you dont like the idea .. dont watch it. Im tired of watching the silly bollywood movies. Zinda was an entertaining movie and i liked it. If its copied from somewhere, well i say it has been copied good. Without Zinda, i would have never came to know about oldboy or its concept. So its much better than watching nothing. All you pathetic critics out there .. eat shit and die!

Monday, January 16, 2006

After one day of procrastinating over going for a movie, we set out yesterday for an ambitious goal of obtaining tickets from pvr on a sunday evening. It ended up with me, prashant, his friend and his friend's friend going for an "art movie" as i would call it (note: except for me, all others are regulars). There are a bunch of people called collectivechaos conducting this. Neo and Zeus .. you miss this crap :DSo what was the movie? .. it was called spring, summer, fall, winter...and spring. Here is my rather intellectual understanding of the movie

Thursday, January 05, 2006

reverend has a blog. He also has a site. Read his "Shadows in John Carmack's next engine" post.I installed Quake4 in my work machine and it didnt work :( . Then i installed it in my laptop .. and it works!! . The graphics is pathetic, but playable. I didnt find any single player deathmatch, did they remove it? (i installed demo)