Archive for January, 2007

Open all marked buffers in Ibuffer

Posted: January 19, 2007 in Emacs

In emacs I use ibuffer to get a dired like list of all my open buffers. Because it’s often quite inconvenient to split emacs windows by hand and assign them the right buffers I came up with this idea: Why not mark some buffers in Ibuffer (with m) and then run a function which splits the windows itself and assigns the marked buffers to them.

So here’s the function:

(defun th-ibuffer-view-marked-buffers (horiz)
  "Open the marked buffers -- each in a separate window. By
default the windows will be created by splitting the current
window vertically, or horizontally if HORIZ is not nil."
  (interactive "P")
  (let ((buffers (ibuffer-marked-buffer-names)))
    (dotimes (var (1- (length buffers)))
      (if horiz
          (split-window-horizontally)
        (split-window-vertically))
      (switch-to-buffer (nth var buffers))
      (other-window 1))
    (switch-to-buffer (car (last buffers)))
    (balance-windows)))

If you call it with a prefix arg it will split the windows horizontally, else it splits vertically.

ARGH!!! Now that I’ve written this fantastic function I found out that ibuffer-do-view and ibuffer-do-view-horizontally do exactly what my function does. Well, at least it was a nice quick elisp hack… :-)

The blog entry Conveniently save and restore frame configurations is related.

UPDATE: Hah, my version is better, because ibuffer-do-view and ibuffer-do-view-horizontally destroy the current window configuration. :-)

Advertisements

Yesterday I was a bit bored and wanted to check out a tiling window manager. My choice fell on dwm and I’m totally excited. Gone are the days where I had to rearrange the windows myself.

One interesting point is that dwm is so lightweight that it can only be configured by editing its source code (config.h) and recompile it. Gentoo has a mechanism which allows saving customized config-header files to /etc/portage/savedconfig/. You can enable it by setting the USE-Flag savedconfig.

The most important thing you have to do as an emacs addict is to change the MODIFIER key from Mod1Mask (= Alt) to some other key, like Mod4Mask (= Windows key).

In contrast to e.g. ratpoison, dwm has a small bar on top of the screen which displays a pager, the title of the focused window and everything dwm receives on stdin. I made a script that informs me via the statusbar if I received a message on my instant messenger.

Another cool feature is that you can toggle between tiling and floating mode with a single keystroke.

So to sum it up: dwm is really worth a try.

Last.fm support for EMMS

Posted: January 4, 2007 in Applications, Emacs

I started using EMMS about 6 month ago, mainly because my Amarok always froze after a while. Even though this problem is solved now I stick with EMMS most of the time.

But one thing I was missing with EMMS was support for the services provided by last.fm. They describe themselves this way:

Scrobbling a song means that when you listen to it, the name of the song is sent to Last.fm and added to your music profile.

Once you’ve signed up and downloaded Last.fm, you can scrobble songs you listen to on your computer or iPod automatically. Start scrobbling yourself, and see what artists you really listen to the most. Songs you listen to will also appear on your Last.fm profile page for others to see.

Millions of songs are scrobbled every day. This data helps Last.fm to organise and recommend music to people; we use it to create personalised radio stations, and a lot more besides.

You can see what Last.fm users listened to the most last week by clicking the Charts button at the top of the page. Add your musical taste into the mix and help us get some decent music into the top 10 :)

To make a long story short: You submit some metadata of the songs you listen to to last.fm and it creates statistics (e.g. charts), does some reasoning (“Many people listening to Britney Spears listen to Christina Aguilera as well, so they seem to make similar music.”) and creates radio stations. Last.fm provides a free player which supports all their services, but there are some third party players with last.fm support, too.

Some weeks ago I joined the EMMS project and implemented the two most important services. Now EMMS can “scrobble” the tracks you listen to, and it can play back last.fm radio. Try it out!

You need to get the developer version of EMMS. Instructions how to fetch it can be found in the quickstart guide. How you manage to start scrobbling or listen to last.fm radio can be looked up in its info documentation.

Have fun!