Posts

Showing posts from October, 2011

Loading Lisp file from URL in Emacs

On a given day, I have to login and work from multiple Linux boxes. One thing I find annoying is that every time I make a change to my .emacs file, I have to copy the changes to all the hosts. There are multiple ways to circumvent this issue. One way I find useful is to maintain my custom file as a gist in github (or any where you can host your .emacs file) and use the following code snippet in the .emacs to load the file from the URL. (with-temp-buffer   (shell-command "curl -Ls https://gist.github.com/raw/372f5e3e8aca632d9b82/hello-world.el" (current-buffer))   (eval-buffer)) Let me explain what this code snippet does: It creates a temporary buffer. With the temporary buffer as the current buffer, it fetches the contents of the URL into the current buffer. It evaluates the current buffer. Remove the temporary buffer. If the sample code above works for you, if you eval the "(hello-world)", it will say "hello world" in the mini buffe...

Fastest way to switch between buffers in Emacs

In any given Emacs session, I have at least 5 buffers open. One of the pains of using C-x b to switch between buffers is that after typing every few characters, you have to type tab to perform completion. It is a waste of time. iswitchb is a much more efficient alternative to the default switch-to-buffer that is invoked while you type C-x b. It is time saving in two ways: (1) there is no need to type tab for completion and (2) you can give any part of the buffer name in the minibuffer prompt and jump to that buffer. To enable this mode, add the following line in your .emacs file. (iswitchb-mode 1)  Thats it. You are ready to rock-n-roll. More info at:  http://www.emacswiki.org/emacs/IswitchBuffers .

Font face customization in Emacs - an easy way

I usually edit source code using Emacs running inside a PuTTY session. One of the struggles I often run into is how to customize different elements I see on the screen. For e.g. the prompt in the shell-mode, previously executed command line, shell input, etc. While I googled around a bit, I came across this incredibly useful key binding: C-u C-x = . It runs the command "what-cursor-position". Here is how you can use this: You position the cursor on the element you would like to customize, and type C-u C-x =. You will be presented with the properties of the character at point, including links to customize the character. I find this extremely useful and hope sharing this information will help others as well. Credit:  http://stackoverflow.com/questions/1242352/get-font-face-under-cursor-in-emacs

Perlbrew saved the day

After an insanely long period of silence, I am writing another blog entry. I couldn't contain my excitement with what I learnt today and hence this post. I had to upgrade Perl installation in my Linux host and I visited Perl.org to download and install Perl. It was suggested to make use of the perlbrew to install and manage different versions of Perl under your home directory. I gave it a try and it was incredibly simple to upgrade the Perl installation in my box, without screwing up the old installation (which I still need for some of the old scripts I have). If you haven't tried it yet, I would strongly recommend.