summaryrefslogtreecommitdiff
path: root/lisp/mpc.el
diff options
context:
space:
mode:
authorMark Oteiza <mvoteiza@udel.edu>2015-11-18 13:46:24 -0500
committerMark Oteiza <mvoteiza@udel.edu>2015-11-27 13:14:06 -0500
commitab10df6097b20f26259cbf8e542163798274099f (patch)
tree73116b518a3b4144cebe3d2e96366150cdf0d3a0 /lisp/mpc.el
parenta521310f9e866d0cb9ab966947ff8e1306b1a7d8 (diff)
downloademacs-ab10df6097b20f26259cbf8e542163798274099f.tar.gz
Backport: Add interactive seek command.
* lisp/mpc.el (mpc-cmd-seekcur): New function. (mpc-seek-current): New command. (mpc-mode-menu): Add entry for mpc-seek-current (mpc-mode-map): Bind mpc-seek-current to "g"
Diffstat (limited to 'lisp/mpc.el')
-rw-r--r--lisp/mpc.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/mpc.el b/lisp/mpc.el
index c40c09cc2ef..3ddcf136787 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -826,6 +826,9 @@ The songs are returned as alists."
(mpc-proc-cmd "play")
(mpc-status-refresh))
+(defun mpc-cmd-seekcur (time)
+ (mpc-proc-cmd (list "seekcur" time) #'mpc-status-refresh))
+
(defun mpc-cmd-add (files &optional playlist)
"Add the songs FILES to PLAYLIST.
If PLAYLIST is t or nil or missing, use the main playlist."
@@ -1127,7 +1130,7 @@ If PLAYLIST is t or nil or missing, use the main playlist."
(define-key map "s" 'mpc-toggle-play)
(define-key map ">" 'mpc-next)
(define-key map "<" 'mpc-prev)
- (define-key map "g" nil)
+ (define-key map "g" 'mpc-seek-current)
map))
(easy-menu-define mpc-mode-menu mpc-mode-map
@@ -1136,6 +1139,7 @@ If PLAYLIST is t or nil or missing, use the main playlist."
["Play/Pause" mpc-toggle-play] ;FIXME: Add one of ⏯/▶/⏸ in there?
["Next Track" mpc-next] ;FIXME: Add ⇥ there?
["Previous Track" mpc-prev] ;FIXME: Add ⇤ there?
+ ["Seek Within Track" mpc-seek-current]
"--"
["Repeat Playlist" mpc-toggle-repeat :style toggle
:selected (member '(repeat . "1") mpc-status)]
@@ -2402,6 +2406,12 @@ This is used so that they can be compared with `eq', which is needed for
(interactive)
(mpc-cmd-pause "0"))
+(defun mpc-seek-current (pos)
+ "Seek within current track."
+ (interactive
+ (list (read-string "Position to go ([+-]seconds): ")))
+ (mpc-cmd-seekcur pos))
+
(defun mpc-toggle-play ()
"Toggle between play and pause.
If stopped, start playback."