When the new playlist is shorter than the previous one, kill the line no longer relevant in the playlist buffer.

This commit is contained in:
Renaud Casenave-Péré 2011-09-06 16:20:00 +09:00
parent 902926e3ee
commit a5f5e07a3b

View file

@ -566,6 +566,14 @@ According to what is in the diff, several actions can be performed:
(kill-line 1)) (kill-line 1))
songs)))) songs))))
(defun empc-playlist-clean-after-playlist (pos)
"Kill all the songs appearing in the playlist buffer that are
located after the end of current playlist."
(empc-with-current-playlist
(goto-char (point-min))
(forward-line pos)
(kill-region (line-beginning-position) (point-max))))
(defun empc-playlist-delete-song () (defun empc-playlist-delete-song ()
"Delete song at point or a range of song if the mark is "Delete song at point or a range of song if the mark is
active." active."
@ -639,6 +647,7 @@ songs order is kept into an avector `empc-current-playlist'."
(let ((new-pl (make-vector (empc-status-get empc-object :playlistlength) nil))) (let ((new-pl (make-vector (empc-status-get empc-object :playlistlength) nil)))
(dotimes (i (min (length new-pl) (length (empc-playlist empc-object)))) (dotimes (i (min (length new-pl) (length (empc-playlist empc-object))))
(aset new-pl i (aref (empc-playlist empc-object) i))) (aset new-pl i (aref (empc-playlist empc-object) i)))
(empc-playlist-clean-after-playlist (length new-pl))
(empc-playlist-set empc-object new-pl) (empc-playlist-set empc-object new-pl)
(while data (while data
(let ((id (string-to-number (cdar data))) (let ((id (string-to-number (cdar data)))