Re: how can I display the current song of bongo player (emacs) in RP's bar?

CSM 'illovae' Seldon <[email protected]>
Newsgroups gmane.comp.window-managers.ratpoison.devel
Message-ID <20100820121323.GA13901@britney>
Hey Memnon,

First, thanks for the reply :)

On Fri, Aug 20, 2010 at 11:56:37AM +0200, Memnon Anon wrote :
> > The trick is I decided to use the function bongo-show which is used to
> > display in the minibuffer the title of the song while you actually play
> > it. When you play foobar, it display /foobar/ in minibuffer so why add
> > something to display /foobar/ too in my RP's bar ?
> 
> I don't think it is a good idea to modify bongo-show directly.
> Next time the code gets updated, you'll have to do it all over again.
> AFAIK, thats what hooks are for: Modifying the program at certain well
> defined points. 

You're right. Actually, at first time, I tried to use hooks when I saw
the possibility available via M-x customize-group bongo, without any
success.
 
> I do not use bongo, but I downloaded it and played around a bit.

Wohw, thank you for that :)

> This is what I came up with:
> 
> --8<---------------cut here---------------start------------->8---
> (add-hook 'bongo-player-started-hook
>      (lambda ()
>        (let (message command))
> 	 (with-bongo-playlist-buffer
> 	   (setq message (bongo-format-infoset (bongo-player-infoset player)))
>; 	   (setq my-message (bongo-format-infoset (bongo-player-infoset player)))
> 	   (setq command (concat "ratpoison -c 'echo " message "'")) 
> 	   (start-process-shell-command "FixMe" nil command))))
> --8<---------------cut here---------------end--------------->8---
> 
> Just start bongo, eval this in your *scratch* buffer and give it a try.
> I only did some quick testing, it can very well not work as you
> expected.

Hah, my gosh, that work perfectly well, as I expected, it's awesome =)

But, if I can say and for the records, I found a typo in that hook when
I tried it. For the persons who read that, you have to correct
/my-message/ to /message/ [line 5].  The hook up there is already
corrected (the line with the typo is commented and can be deleted) so it
can be use as it :)

Memnon, again thank you very very much, it's perfect for me. I'm going
to create a new page about that on the RP's wiki and add these lines for
others users :)

-- illovae.

PS: by the way, what are you using to get the /cut here/ thing for your
code please ? Thanks by advance.


-- 
-----------------------------------------------------------+
CSM 'illovae' Seldon                 druuna (at) dud-t.org |
Independent Crisis Ombudsman (PP)    gopher://12.dud-t.org |
----------------------------------------------------{,_,"> | 
---- Sic transit hominis regnum. Gens nova omnipoten. -----+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.