Once upon a time, I started using the EMMS interface to play some Internet music streams, but instead of feeble attempts to remember cryptic URLs, I wrapped it in a play-jazz function:

( defun play-jazz () "Start up some nice Jazz" ( interactive ) ( emms-play-streamlist "http://thejazzgroove.com/itunes.pls" ))

Type M-x play-jazz to kick off the tunes, and M-x emms-stop to pause. While one can not live by jazz alone, it seemed silly to create a bunch of named functions for URL mappings.

On my Kinesis keyboard, F9 is prominent, easy to reach, and my go-to key for flow interrupting requests (for instance, F9 g issues a magit-status ). Key sequences starting with F9 m start music streams, with F9 m s stopping the music.

Below is my code to iterate over a list of letter combinations and an associated URL. First, define a key map:

( define-prefix-command 'personal-music-map ) ( global-set-key ( kbd "<f9> m" ) 'personal-music-map )

Second, use dolist to iterate over a list of tuples so that car returns the key and cdr supplies the URL:

( dolist ( station ' (( "a" . "http://stereoscenic.com/pls/pill-hi-mp3.pls" ) ;; Ambient ( "t" . "http://www.1.fm/tunein/trance64k.pls" ) ;; Trance ( "j" . "http://thejazzgroove.com/itunes.pls" ))) ;; Jazz ( lexical-let (( keystroke ( car station )) ( stream ( cdr station ))) ( define-key personal-music-map ( kbd keystroke ) ( lambda () ( interactive ) ( emms-play-streamlist stream )))))

For each element in my list, I add to personal-music-map (using the define-key function), and I create an interactive function that calls emms-play-streamlist with the URL.