aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Oteiza2015-11-18 13:46:24 -0500
committerMark Oteiza2015-11-18 13:46:24 -0500
commit5bc966dfdae62cbcb5698f77adffada4fbf445d7 (patch)
treec670f3786e2ab10c891b9c242adf205e8cae1aff
parent0b007bca9004faad67b4ba3dfcb9cf7538ac299c (diff)
downloademacs-5bc966dfdae62cbcb5698f77adffada4fbf445d7.tar.gz
emacs-5bc966dfdae62cbcb5698f77adffada4fbf445d7.zip
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"
-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."
826 (mpc-proc-cmd "play") 826 (mpc-proc-cmd "play")
827 (mpc-status-refresh)) 827 (mpc-status-refresh))
828 828
829(defun mpc-cmd-seekcur (time)
830 (mpc-proc-cmd (list "seekcur" time) #'mpc-status-refresh))
831
829(defun mpc-cmd-add (files &optional playlist) 832(defun mpc-cmd-add (files &optional playlist)
830 "Add the songs FILES to PLAYLIST. 833 "Add the songs FILES to PLAYLIST.
831If PLAYLIST is t or nil or missing, use the main playlist." 834If 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."
1127 (define-key map "s" 'mpc-toggle-play) 1130 (define-key map "s" 'mpc-toggle-play)
1128 (define-key map ">" 'mpc-next) 1131 (define-key map ">" 'mpc-next)
1129 (define-key map "<" 'mpc-prev) 1132 (define-key map "<" 'mpc-prev)
1130 (define-key map "g" nil) 1133 (define-key map "g" 'mpc-seek-current)
1131 map)) 1134 map))
1132 1135
1133(easy-menu-define mpc-mode-menu mpc-mode-map 1136(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."
1136 ["Play/Pause" mpc-toggle-play] ;FIXME: Add one of ⏯/▶/⏸ in there? 1139 ["Play/Pause" mpc-toggle-play] ;FIXME: Add one of ⏯/▶/⏸ in there?
1137 ["Next Track" mpc-next] ;FIXME: Add ⇥ there? 1140 ["Next Track" mpc-next] ;FIXME: Add ⇥ there?
1138 ["Previous Track" mpc-prev] ;FIXME: Add ⇤ there? 1141 ["Previous Track" mpc-prev] ;FIXME: Add ⇤ there?
1142 ["Seek Within Track" mpc-seek-current]
1139 "--" 1143 "--"
1140 ["Repeat Playlist" mpc-toggle-repeat :style toggle 1144 ["Repeat Playlist" mpc-toggle-repeat :style toggle
1141 :selected (member '(repeat . "1") mpc-status)] 1145 :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
2402 (interactive) 2406 (interactive)
2403 (mpc-cmd-pause "0")) 2407 (mpc-cmd-pause "0"))
2404 2408
2409(defun mpc-seek-current (pos)
2410 "Seek within current track."
2411 (interactive
2412 (list (read-string "Position to go ([+-]seconds): ")))
2413 (mpc-cmd-seekcur pos))
2414
2405(defun mpc-toggle-play () 2415(defun mpc-toggle-play ()
2406 "Toggle between play and pause. 2416 "Toggle between play and pause.
2407If stopped, start playback." 2417If stopped, start playback."