[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/listen 2ac2eed1fd 082/103: Add: (listen-queue-shell-com
From: |
ELPA Syncer |
Subject: |
[elpa] externals/listen 2ac2eed1fd 082/103: Add: (listen-queue-shell-command) |
Date: |
Mon, 26 Feb 2024 12:59:32 -0500 (EST) |
branch: externals/listen
commit 2ac2eed1fd1f78f7dbc37bd6846d3e1146c6090e
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Add: (listen-queue-shell-command)
---
README.org | 1 +
listen-queue.el | 39 ++++++++++++++++++++++++++++++++++++++-
listen.info | 6 ++++--
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/README.org b/README.org
index 210730f08b..52a109fe9b 100644
--- a/README.org
+++ b/README.org
@@ -53,6 +53,7 @@ Use the command ~listen~ to show the Transient menu. From
there, it is--hopeful
*Additions*
+ Command ~listen-queue-jump~ jumps to the currently playing track in the
queue.
++ Command ~listen-queue-shell-command~ runs a shell command on the tracks
selected in the queue.
*Fixes*
+ The queue could sometimes skip tracks when playing.
diff --git a/listen-queue.el b/listen-queue.el
index 22a95dc562..9875f30a99 100644
--- a/listen-queue.el
+++ b/listen-queue.el
@@ -129,7 +129,8 @@
"RET" (lambda (track) (listen-queue-play queue
track))
"SPC" (lambda (_) (call-interactively
#'listen-pause))
"o" (lambda (_) (call-interactively
#'listen-queue-order-by))
- "s" (lambda (_) (listen-queue-shuffle
listen-queue)))))
+ "s" (lambda (_) (listen-queue-shuffle listen-queue))
+ "!" (lambda (_) (call-interactively
#'listen-queue-shell-command)))))
(goto-char (point-min))
(listen-queue--highlight-current)
(hl-line-mode 1)))
@@ -340,6 +341,29 @@ PROMPT is passed to `format-prompt', which see."
(seq-elt (listen-queue-tracks queue)
(1+ (seq-position (listen-queue-tracks queue)
(listen-queue-current queue)))))
+(declare-function listen-shell-command "listen")
+(defun listen-queue-shell-command (command filenames)
+ "Run COMMAND on FILENAMES.
+Interactively, read COMMAND and use tracks at point in current
+queue buffer."
+ (interactive
+ (let* ((filenames (mapcar #'listen-track-filename (listen-queue-selected)))
+ (command (read-shell-command (format "Run command on %S: "
filenames))))
+ (list command filenames)))
+ (listen-shell-command command filenames)
+ ;; NOTE: This code below would be great but for using async shell
+ ;; command in `listen-shell-command'. Also, if the files end up
+ ;; renamed, they'll not be found, but that's up to the user.
+ ;; (seq-do (lambda (filename)
+ ;; (setf (seq-elt (listen-queue-tracks listen-queue)
+ ;; (seq-position (listen-queue-tracks listen-queue)
filename
+ ;; (lambda (track)
+ ;; (equal filename
(listen-track-filename track)))))
+ ;; (listen-queue-track filename)))
+ ;; filenames)
+ ;; (listen-queue-revert)
+ )
+
(defun listen-queue-order-by ()
"Order the queue by the column at point.
@@ -358,6 +382,19 @@ tracks in the queue unchanged)."
do (forward-line 1))))
(vtable-revert-command))
+(defun listen-queue-selected ()
+ "Return tracks selected in current queue buffer."
+ (cl-assert listen-queue)
+ (if (not (region-active-p))
+ (vtable-current-object)
+ (let ((beg (region-beginning))
+ (end (region-end)))
+ (save-excursion
+ (goto-char beg)
+ (cl-loop collect (vtable-current-object)
+ do (forward-line 1)
+ while (<= (point) end))))))
+
;;;;; Bookmark support
(require 'bookmark)
diff --git a/listen.info b/listen.info
index 4bdc8ca4f7..b9ab917ba0 100644
--- a/listen.info
+++ b/listen.info
@@ -115,6 +115,8 @@ File: README.info, Node: v02-pre, Next: v01, Up:
Changelog
*Additions*
• Command ‘listen-queue-jump’ jumps to the currently playing track in
the queue.
+ • Command ‘listen-queue-shell-command’ runs a shell command on the
+ tracks selected in the queue.
*Fixes*
• The queue could sometimes skip tracks when playing.
@@ -149,8 +151,8 @@ Node: Configuration2537
Node: Usage2876
Node: Changelog3147
Node: v02-pre3299
-Node: v013570
-Node: Development3672
+Node: v013681
+Node: Development3783
End Tag Table
- [elpa] externals/listen 97b457581b 090/103: Tidy: (listen-faces) Docstring, (continued)
- [elpa] externals/listen 97b457581b 090/103: Tidy: (listen-faces) Docstring, ELPA Syncer, 2024/02/26
- [elpa] externals/listen bdfc2a94b3 098/103: Add: (listen-queue-library), ELPA Syncer, 2024/02/26
- [elpa] externals/listen 9a94dcc289 093/103: Docs: Mention Philip Kaludercic, ELPA Syncer, 2024/02/26
- [elpa] externals/listen afe3280c5d 032/103: Fixes and tidy, ELPA Syncer, 2024/02/26
- [elpa] externals/listen 67ef450cb7 053/103: Tidy, ELPA Syncer, 2024/02/26
- [elpa] externals/listen 58eb2d9721 051/103: Mode, ELPA Syncer, 2024/02/26
- [elpa] externals/listen d215ddc330 058/103: Autoload bookmark handler, ELPA Syncer, 2024/02/26
- [elpa] externals/listen be4e25fda4 048/103: Queue bookmarks, ELPA Syncer, 2024/02/26
- [elpa] externals/listen e3c23b00f1 073/103: Release: v0.1, ELPA Syncer, 2024/02/26
- [elpa] externals/listen f4e2d8d71f 084/103: Add: (listen-queue-refresh), ELPA Syncer, 2024/02/26
- [elpa] externals/listen 2ac2eed1fd 082/103: Add: (listen-queue-shell-command),
ELPA Syncer <=
- [elpa] externals/listen d84c2e8745 063/103: Library bookmarks, ELPA Syncer, 2024/02/26
- [elpa] externals/listen 6ea353586e 086/103: Release: v0.2, ELPA Syncer, 2024/02/26
- [elpa] externals/listen d41da92402 096/103: Change: (listen-mpd-completing-read) Use completing-read-multiple, ELPA Syncer, 2024/02/26
- [elpa] externals/listen e4cdd0cf6c 064/103: Library and shell command improvements, ELPA Syncer, 2024/02/26
- [elpa] externals/listen 214b87215c 067/103: Fix: (listen-mode-lighter), ELPA Syncer, 2024/02/26
- [elpa] externals/listen d417f11c49 068/103: Tidy, ELPA Syncer, 2024/02/26
- [elpa] externals/listen 1371d14c26 062/103: Update docs, commentary, ELPA Syncer, 2024/02/26
- [elpa] externals/listen 294a129ff2 081/103: Revert "Change: (listen-queue--update-buffer) Add REVERTP argument", ELPA Syncer, 2024/02/26
- [elpa] externals/listen b515c309ab 046/103: Improve transient, ELPA Syncer, 2024/02/26
- [elpa] externals/listen b9d4fd6c17 071/103: Order queue, faces, etc, ELPA Syncer, 2024/02/26