[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/listen f7554a35b8 1/3: Add: (listen-jump) et al
From: |
ELPA Syncer |
Subject: |
[elpa] externals/listen f7554a35b8 1/3: Add: (listen-jump) et al |
Date: |
Sun, 3 Mar 2024 15:58:12 -0500 (EST) |
branch: externals/listen
commit f7554a35b80bb9285a4d4afcba3a8c4c1989add1
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Add: (listen-jump) et al
---
README.org | 1 +
listen-library.el | 8 ++++++++
listen-queue.el | 8 +++++---
listen.el | 41 +++++++++++++++++++++++++----------------
4 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/README.org b/README.org
index 44407d6729..55d8930d09 100644
--- a/README.org
+++ b/README.org
@@ -68,6 +68,7 @@ Use the command ~listen~ to show the Transient menu. From
there, it is--hopeful
** v0.5-pre
*Additions*
++ Command ~listen-jump~ (bound to ~j~ in queue and library buffers) jumps to
the track at point in a Dired buffer.
+ Option ~listen-queue-repeat-mode~ (also settable in ~listen-menu~) allows
repeating a queue in-order or shuffled.
+ Show total queue duration at bottom of track list.
diff --git a/listen-library.el b/listen-library.el
index bd4e3dd3f2..66bb2ee03a 100644
--- a/listen-library.el
+++ b/listen-library.el
@@ -87,6 +87,7 @@
;;;; Mode
(declare-function listen-menu "listen")
+(declare-function listen-jump "listen")
(defvar-keymap listen-library-mode-map
:parent magit-section-mode-map
@@ -94,6 +95,7 @@
"!" #'listen-library-shell-command
"a" #'listen-library-add-tracks
"g" #'listen-library-revert
+ "j" #'listen-library-jump
"RET" #'listen-library-play-or-add)
(define-derived-mode listen-library-mode magit-section-mode "Listen-Library"
@@ -157,6 +159,12 @@ prompt for a QUEUE to add them to."
(listen-queue-add-files (mapcar #'listen-track-filename tracks) queue)
(listen-play (listen--player) (listen-track-filename (car tracks)))))
+(defun listen-library-jump (track)
+ "Jump to TRACK in a Dired buffer."
+ (interactive
+ (list (car (listen-library--selected-tracks))))
+ (listen-jump track))
+
(declare-function listen-shell-command "listen")
(defun listen-library-shell-command (command filenames)
"Run COMMAND on FILENAMES.
diff --git a/listen-queue.el b/listen-queue.el
index 2562a76106..65a51ddbc0 100644
--- a/listen-queue.el
+++ b/listen-queue.el
@@ -88,6 +88,7 @@ intended to be set from the `listen-menu'."
;; (with-current-buffer list-buffer
;; (vtable-revert)))))
+(declare-function listen-jump "listen")
(declare-function listen-menu "listen")
(declare-function listen-pause "listen")
;;;###autoload
@@ -157,7 +158,7 @@ intended to be set from the `listen-menu'."
:actions (list "q" (lambda (_) (bury-buffer))
"?" (lambda (_) (call-interactively #'listen-menu))
"g" (lambda (_) (call-interactively
#'listen-queue-revert))
- "j" (lambda (_) (listen-queue-jump))
+ "j" #'listen-jump
"n" (lambda (_) (forward-line 1))
"p" (lambda (_) (forward-line -1))
"N" (lambda (track)
(listen-queue-transpose-forward track queue))
@@ -240,7 +241,8 @@ If BACKWARDP, move it backward."
(vtable-revert-command))
(goto-char pos)
(goto-char (pos-bol)))
- (listen-queue--highlight-current))))
+ (listen-queue--highlight-current)
+ (listen-queue-goto-current))))
(declare-function listen-mode "listen")
(declare-function listen-play "listen")
@@ -264,7 +266,7 @@ select track as well."
(listen-mode))
queue)
-(defun listen-queue-jump ()
+(defun listen-queue-goto-current ()
"Jump to current track."
(interactive)
(when-let ((current-track (listen-queue-current listen-queue)))
diff --git a/listen.el b/listen.el
index f33f42ebfe..886d06288c 100755
--- a/listen.el
+++ b/listen.el
@@ -171,6 +171,12 @@ command with completion."
(display-buffer-alist `((,(regexp-quote
shell-command-buffer-name-async) display-buffer-no-window))))
(async-shell-command command)))
+(defun listen-jump (track)
+ "Jump to TRACK in a Dired buffer.
+Interactively, jump to current queue's current track."
+ (interactive (list (listen-queue-current (map-elt (listen-player-etc
(listen--player)) :queue))))
+ (dired-jump nil (listen-track-filename track)))
+
;;;; Mode
(defvar listen-mode-lighter nil)
@@ -324,6 +330,17 @@ TIME is a string like \"SS\", \"MM:SS\", or \"HH:MM:SS\"."
(let ((player (listen--player)))
(listen-volume player (min 100 (+ (listen--volume player)
5)))))
:transient t)]
+ ["Repeat"
+ ("rn" "None" (lambda () (interactive) (setopt listen-queue-repeat-mode
nil))
+ :inapt-if (lambda () (not listen-queue-repeat-mode)))
+ ("rq" "Queue" (lambda () (interactive) (setopt listen-queue-repeat-mode
'queue))
+ :inapt-if (lambda () (eq 'queue listen-queue-repeat-mode)))
+ ("rs" "Queue and shuffle" (lambda () (interactive) (setopt
listen-queue-repeat-mode 'shuffle))
+ :inapt-if (lambda () (eq 'shuffle listen-queue-repeat-mode)))
+ ;; ("qrt" "Track" (lambda () (interactive) (setopt
listen-queue-repeat-mode 'track))
+ ;; :inapt-if (lambda () (eq 'track listen-queue-repeat-mode)))
+ ]
+
["Library view"
("lf" "from files" listen-library)
("lm" "from MPD" listen-library-from-mpd)
@@ -355,12 +372,7 @@ TIME is a string like \"SS\", \"MM:SS\", or \"HH:MM:SS\"."
("qD" "Discard" listen-queue-discard
:transient t)]
["Tracks"
- ("qaf" "Add files" listen-queue-add-files
- :transient t)
- ("qam" "Add from MPD" listen-queue-add-from-mpd
- :transient t)
- ("qap" "Add from playlist file" listen-queue-add-from-playlist-file
- :transient t)
+ ("qj" "Jump to current in Dired" listen-jump)
("qt" "Play track" (lambda ()
"Call `listen-queue-play' with prefix."
(interactive)
@@ -371,16 +383,13 @@ TIME is a string like \"SS\", \"MM:SS\", or \"HH:MM:SS\"."
:transient t)
("qs" "Shuffle" (lambda () (interactive) (call-interactively
#'listen-queue-shuffle))
:transient t)]
- ["Repeat"
- ("qrn" "None" (lambda () (interactive) (setopt listen-queue-repeat-mode
nil))
- :inapt-if (lambda () (not listen-queue-repeat-mode)))
- ("qrq" "Queue" (lambda () (interactive) (setopt listen-queue-repeat-mode
'queue))
- :inapt-if (lambda () (eq 'queue listen-queue-repeat-mode)))
- ("qrs" "Queue and shuffle" (lambda () (interactive) (setopt
listen-queue-repeat-mode 'shuffle))
- :inapt-if (lambda () (eq 'shuffle listen-queue-repeat-mode)))
- ;; ("qrt" "Track" (lambda () (interactive) (setopt
listen-queue-repeat-mode 'track))
- ;; :inapt-if (lambda () (eq 'track listen-queue-repeat-mode)))
- ]])
+ ["Add tracks"
+ ("qaf" "from files" listen-queue-add-files
+ :transient t)
+ ("qam" "from MPD" listen-queue-add-from-mpd
+ :transient t)
+ ("qap" "from playlist file" listen-queue-add-from-playlist-file
+ :transient t)]])
(provide 'listen)