Christophe Weblog Wiki Code Publications Music
(ab)use mode-line-process to display preset in the mode line
[iplayer-el.git] / iplayer.el
index 47ec879760498c184a98e8207e0b1a2486be8ec6..68d3a01190c95b22d37211623fa80b3168721478 100644 (file)
   (interactive "p")
   (let ((keys (this-command-keys))
         (presets (mapcar (lambda (x) (cons (read-kbd-macro (car x)) (cdr x))) iplayer-presets)))
-    (message "%s" (this-command-keys))
     (cond
      ((= (length keys) 1)
       (let ((channel (cdr (assoc keys presets))))
         (if channel
-            (iplayer-channel (format "^%s$" channel))
+            (progn
+              (setq mode-line-process (format "[%s]" channel))
+              (iplayer-channel (format "^%s$" channel)))
           (error "no preset for key %s" keys)))))))
 
 (defun iplayer-channel (channel)
 
 (defun iplayer ()
   (interactive)
+  (setq mode-line-process nil)
   (display-iplayer-tree (get-iplayer-tree)))
 
 (provide 'iplayer)