[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emms-help] Bug fix in emms-pbi.el

From: Yoni Rabkin Katzenell
Subject: [emms-help] Bug fix in emms-pbi.el
Date: Tue, 21 Dec 2004 16:31:50 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

Short description: It is impossible to remove the last track from the
playlist using C-k in the pbi buffer.

Let us start with how to recreate the bug:

1. Load EMMS CVS.
2. Load a single track into the playlist. I used M-x emms-streams and
   pressed RET on a random track.
3. M-x emms-pbi -> there is now a single track listed in the *Playlist*
4. C-k on the track. -> the track dissapears.

!! At this point note that is you eval emms-playlist the track is still

5. M-x emms-pbi -> the track we deleted re-appears!

Now for some analysis:

I found out that when you C-k the only track left then the function
`emms-pbi-kill-line' never reaches the line "(emms-playlist-remove
idx)))". This is because that the function "(delete-backward-char 1)"
emits an error in the form of "Beggining of buffer" and the evaluation
of the function stops there. So in fact you can never remove the last

My fix:

Two places in the function `emms-pbi-kill-line' in emms-pbi:

+      (condition-case nil
+         (progn
            (delete-region (point-at-bol) (point-at-eol))
            (forward-line 1)      
            (delete-backward-char 1))
+       (error nil))

Enclosed the section to ignore the delete error.

Unfortunately this causes another error that never surfaced because the
code never evaluated beyond this point in that the comparison 
"(= idx emms-playlist-current)"
compares a number (0) and NIL. So I added:

+    (unless (null emms-playlist-current)
      (when (= idx emms-playlist-current) 
        (emms-stop) (emms-start))

Finally, I have not commited the fix since this is not my code I'm
playing with here but Ulrik's. He might see things that I did not and I
would like to know what you people think.

"Cut your own wood and it will warm you twice"
        Regards, Yoni Rabkin Katzenell

reply via email to

[Prev in Thread] Current Thread [Next in Thread]