Function: mpc-prev

mpc-prev is an interactive and byte-compiled function defined in mpc.el.gz.

Signature

(mpc-prev)

Documentation

Jump to the beginning of the current song, or to the previous song.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mpc.el.gz
(defun mpc-prev ()
  "Jump to the beginning of the current song, or to the previous song."
  (interactive)
  (let ((time (cdr (assq 'time mpc-status))))
    ;; Here we rely on the fact that string-to-number silently ignores
    ;; everything after a non-digit char.
    (cond
     ;; Go back to the beginning of current song.
     ((and time (> (string-to-number time) 0))
      (mpc-proc-cmd (list "seekid" (cdr (assq 'songid mpc-status)) 0)))
     ;; We're at the beginning of the first song of the playlist.
     ;; Fetch the previous one from `mpc-queue-back'.
     ;; ((and (zerop (string-to-number (cdr (assq 'song mpc-status))))
     ;;       mpc-queue-back)
     ;;  ;; Because we use cmd-list rather than cmd-play, the queue is not
     ;;  ;; automatically updated.
     ;;  (let ((prev (pop mpc-queue-back)))
     ;;    (push prev mpc-queue)
     ;;    (mpc-proc-cmd
     ;;     (mpc-proc-cmd-list
     ;;      (list (list "add" prev)
     ;;            (list "move" (cdr (assq 'playlistlength mpc-status)) "0")
     ;;            "previous")))))
     ;; We're at the beginning of a song, but not the first one.
     (t (mpc-proc-cmd "previous")))
    (mpc-status-refresh)))