Function: mpc-songpointer-context

mpc-songpointer-context is a byte-compiled function defined in mpc.el.gz.

Signature

(mpc-songpointer-context SIZE PLBUF)

Source Code

;; Defined in /usr/src/emacs/lisp/mpc.el.gz
(defun mpc-songpointer-context (size plbuf)
  (with-current-buffer plbuf
    (goto-char (point-min))
    (forward-line (string-to-number (or (cdr (assq 'song mpc-status)) "0")))
    (let ((context-before '())
          (context-after '()))
      (save-excursion
        (dotimes (_i size)
          (when (re-search-backward "^[0-9]+:\\(.*\\)" nil t)
            (push (mpc-songs-hashcons (match-string 1)) context-before))))
      ;; Skip the actual current song.
      (forward-line 1)
      (dotimes (_i size)
        (when (re-search-forward "^[0-9]+:\\(.*\\)" nil t)
          (push (mpc-songs-hashcons (match-string 1)) context-after)))
      ;; If there isn't `size' context, then return nil.
      (unless (and (< (length context-before) size)
                   (< (length context-after) size))
        (cons (nreverse context-before) (nreverse context-after))))))