[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 902f31d 1/2: New user option mpc-cover-image-re
From: |
Stefan Kangas |
Subject: |
Re: master 902f31d 1/2: New user option mpc-cover-image-re |
Date: |
Wed, 29 Sep 2021 06:11:54 -0700 |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Hi Stefan,
>
> Nice to see someone contributing to `mpc.el`.
> Any chance you can be tempted to implement support for the
> `idle` command?
I have various small various fixes and improvements in the cooker, but
implementing "idle" does sound like a fair bit more work. Let me think
about it. IIUC, it would basically make mpc.el less synchronous?
Meanwhile, maybe you can help me with this. I have implemented the
below command, but when I run it outside of the "*Songs*" buffer, it
doesn't work. I also can't add it to the end of `mpc' (to make point
start near the currently playing song). I'm probably missing something
very obvious...
Also, once I get this working, any objections to the keybinding "o" for
this? (This is the same key as in ncmpcpp.)
(This is an important feature for me, as I typically have very long
playlists that doubles as notes of what I've been listening to
recently.)
diff --git a/lisp/mpc.el b/lisp/mpc.el
index ad32ce8d33..06b80b1423 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -2669,6 +2669,16 @@ mpc-play-at-point
(mpc-select event)
(mpc-play))
+(defun mpc-jump-to-playing ()
+ "Move point to the currently playing song in the \"*Songs*\" buffer."
+ (interactive)
+ (let ((buf (mpc-proc-buffer (mpc-proc) 'songs)))
+ (when (buffer-live-p buf)
+ (with-current-buffer buf
+ (when (and overlay-arrow-position
+ (eq (marker-buffer overlay-arrow-position) buf))
+ (goto-char (marker-position overlay-arrow-position)))))))
+
;; (defun mpc-play-tagval ()
;; "Play all the songs of the tag at point."
;; (interactive)