aboutsummaryrefslogtreecommitdiff
path: root/emms-bookmarks.el
diff options
context:
space:
mode:
authoryoni-r <yoni-r>2006-09-26 07:15:00 +0000
committeryoni-r <mwolson@gnu.org>2006-09-26 07:15:00 +0000
commitdc0f30f3eeb9ece27f60537ad5d0160045308ae5 (patch)
treef54ccab041cd99e185ea60ae6d582ac050947b88 /emms-bookmarks.el
parent03bc583073b06d1f2b36c62227d8d0d59ea4aa36 (diff)
DoTheRightThing with player pausing and emms-bookmarks.el
darcs-hash:20060926071538-85c19-18986d89ae4cb5463db57249c4ee0ef5f2360cbc.gz
Diffstat (limited to 'emms-bookmarks.el')
-rw-r--r--emms-bookmarks.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/emms-bookmarks.el b/emms-bookmarks.el
index fbd0195..e411abd 100644
--- a/emms-bookmarks.el
+++ b/emms-bookmarks.el
@@ -120,6 +120,13 @@ FAILURE-MESSAGE should be a string."
(emms-playlist-current-selected-track)
"No previous bookmark"))
+(defmacro emms-bookmarks-with-paused-player (&rest body)
+ "Eval BODY with player paused."
+ `(progn
+ (when (not emms-player-paused-p) (emms-pause))
+ ,@body
+ (when emms-player-paused-p (emms-pause))))
+
;; can't use `interactive' to promt the user here because we want to
;; pause the player before the prompt appears.
(defun emms-bookmarks-add ()
@@ -129,12 +136,11 @@ This function pauses the player while promting the user for a
description of the bookmark. The function resumes the player
after the prompt."
(interactive)
- (emms-pause)
- (let ((desc (read-string "Description: ")))
- (if (emms-playlist-current-selected-track)
- (emms-bookmarks-set-current desc)
- (error "No current track to bookmark")))
- (emms-pause))
+ (emms-bookmarks-with-paused-player
+ (let ((desc (read-string "Description: ")))
+ (if (emms-playlist-current-selected-track)
+ (emms-bookmarks-set-current desc)
+ (error "No current track to bookmark")))))
(defun emms-bookmarks-clear ()
"Remove all the bookmarks from the current track."