From: Francois Fleuret Date: Tue, 10 Mar 2015 14:04:38 +0000 (+0100) Subject: Reset media/current-information when the song terminates (or if there is a player... X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=elisp.git;a=commitdiff_plain;h=6a44bdf65c8691602f917c8d5b4d8d751efa83d7 Reset media/current-information when the song terminates (or if there is a player error) --- diff --git a/media.el b/media.el index d10e96f..25b19ec 100644 --- a/media.el +++ b/media.el @@ -870,6 +870,19 @@ the 'Queue' playlist, and plays it if no song is currently playing." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun media/player-error () + (message "Player error") + (setq media/current-information nil) + (media/remove-highlight)) + +(defun media/song-terminates () + (with-current-buffer media/buffer + (if media/continue-mode (media/play-next t) + (setq media/current-information nil) + (media/remove-highlight)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (defun media/switch-continue-mode () "Switches between a mode which automatically chains files and a mode which stops when the songs ends." @@ -880,15 +893,6 @@ which stops when the songs ends." (message "Continue mode switched off.")) ) -(defun media/player-error () - (message "Player error") - (media/remove-highlight)) - -(defun media/song-terminates () - (with-current-buffer media/buffer - (if media/continue-mode (media/play-next t) - (media/remove-highlight)))) - (defun media/duration-to-string (duration) (let ((sec (mod duration 60)) (min (/ duration 60)))