emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 5bc966d: Add interactive seek command.


From: Mark Oteiza
Subject: [Emacs-diffs] master 5bc966d: Add interactive seek command.
Date: Wed, 18 Nov 2015 18:48:05 +0000

branch: master
commit 5bc966dfdae62cbcb5698f77adffada4fbf445d7
Author: Mark Oteiza <address@hidden>
Commit: Mark Oteiza <address@hidden>

    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"
---
 lisp/mpc.el |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/lisp/mpc.el b/lisp/mpc.el
index c40c09c..3ddcf13 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]