[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ampc 1bc7428150 069/111: * ampc.el (ampc-handle-command
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ampc 1bc7428150 069/111: * ampc.el (ampc-handle-command): Handle mini-currentsong. |
Date: |
Tue, 20 Feb 2024 18:16:41 -0500 (EST) |
branch: externals/ampc
commit 1bc74281501d5afeff6e7b438de9c09f9743f6df
Author: Christopher Schmidt <christopher@ch.ristopher.com>
Commit: Christopher Schmidt <christopher@ch.ristopher.com>
* ampc.el (ampc-handle-command): Handle mini-currentsong.
(ampc-status): Add optional argument no-print. All users of ampc-status
changed.
(ampc): Add optional argument suspend.
---
ampc.el | 47 ++++++++++++++++++++++++++++++++++++++---------
1 file changed, 38 insertions(+), 9 deletions(-)
diff --git a/ampc.el b/ampc.el
index 04d0c73703..00200911d2 100644
--- a/ampc.el
+++ b/ampc.el
@@ -195,8 +195,23 @@
;; If ampc is suspended, you can still use every interactive command that does
;; not directly operate on or with the user interace of ampc. For example it
is
;; perfectly fine to call `ampc-increase-volume' or `ampc-toggle-play' via M-x
-;; RET. To display the information that is displayed by the status window of
-;; ampc, call `ampc-status'.
+;; RET. Especially the commands `ampc-status' and `ampc-mini' are
predestinated
+;; to be bound in the global keymap. `ampc-status' messages the information
+;; that is displayed by the status window of ampc. `ampc-mini' lets you select
+;; a song to play via `completing-read'.
+;;
+;; (global-set-key (kbd "<f7>")
+;; (lambda ()
+;; (interactive)
+;; (unless (ampc-on-p)
+;; (ampc nil nil t))
+;; (ampc-status)))
+;; (global-set-key (kbd "<f8>")
+;; (lambda ()
+;; (interactive)
+;; (unless (ampc-on-p)
+;; (ampc nil nil t))
+;; (ampc-mini)))
;;; Code:
;;; * code
@@ -1218,7 +1233,7 @@ all the time!"
(delete-region (point-min) (point-max))
(funcall (or (plist-get (cadr ampc-type) :filler)
(lambda (_)
- (insert (ampc-status) "\n")))
+ (insert (ampc-status t) "\n")))
ampc-status)
(ampc-set-dirty nil)))
@@ -1385,6 +1400,8 @@ all the time!"
(ampc-fill-current-playlist))
(mini-playlistinfo
(ampc-mini-impl))
+ (mini-currentsong
+ (ampc-status))
(listallinfo
(ampc-fill-internal-db nil))
(outputs
@@ -1871,10 +1888,17 @@ If ARG is omitted, use the selected entries in the
current buffer."
(ampc-with-selection arg
(ampc-add-impl)))
-(defun ampc-status ()
- "Display the information that is displayed in the status window."
+(defun* ampc-status (&optional no-print)
+ "Display and return the information that is displayed in the status window.
+If optional argument NO-PRINT is non-nil, just return the text.
+If NO-PRINT is nil, the display may be delayed if ampc does not
+have enough information yet."
(interactive)
(assert (ampc-on-p))
+ (unless (or ampc-status no-print)
+ (ampc-send-command 'status t)
+ (ampc-send-command 'mini-currentsong t)
+ (return-from ampc-status))
(let* ((flags (mapconcat
'identity
(loop for (f . n) in '((repeat . "Repeat")
@@ -1886,7 +1910,7 @@ If ARG is omitted, use the selected entries in the
current buffer."
"|"))
(state (cdr (assq 'state ampc-status)))
(status (concat "State: " state
- (when ampc-yield
+ (when (and ampc-yield no-print)
(concat (make-string (- 10 (length state)) ? )
(nth (% ampc-yield 4) '("|" "/" "-" "\\"))))
"\n"
@@ -1902,7 +1926,7 @@ If ARG is omitted, use the selected entries in the
current buffer."
"Crossfade: " (cdr (assq 'xfade ampc-status))
(unless (equal flags "")
(concat "\n" flags)))))
- (when (called-interactively-p 'interactive)
+ (unless no-print
(message "%s" status))
status))
@@ -2013,7 +2037,8 @@ ampc is connected to."
(run-hooks 'ampc-quit-hook))
;;;###autoload
-(defun ampc (&optional host port)
+;;;###autoload
+(defun ampc (&optional host port suspend)
"ampc is an asynchronous client for the MPD media player.
This function is the main entry point for ampc.
@@ -2052,8 +2077,12 @@ connect to. The values default to localhost:6600."
(set-process-filter ampc-connection 'ampc-filter)
(set-process-query-on-exit-flag ampc-connection nil)
(setf ampc-outstanding-commands '((setup))))
- (ampc-configure-frame (cddar ampc-views))
+ (if suspend
+ (ampc-update)
+ (ampc-configure-frame (cddar ampc-views)))
(run-hooks 'ampc-connected-hook)
+ (when suspend
+ (ampc-suspend))
(ampc-filter (process-buffer ampc-connection) nil))
(provide 'ampc)
- [elpa] externals/ampc 0941e8d180 079/111: * ampc.el: Make ampc synchronous., (continued)
- [elpa] externals/ampc 0941e8d180 079/111: * ampc.el: Make ampc synchronous., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 2b4cbc7db9 088/111: * ampc.el: Use tab-stop-list for tabulated lists., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 0bf832e424 092/111: * Add tagger. ampc-tagger.cpp: New file., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 5aae56a25d 101/111: * packages/ampc/ampc.el: Add proper file trailer., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 259d4f6363 103/111: * ampc/ampc.el: Fix up warnings and use cl-lib. Change maintainer, Stefan Monnier, 2024/02/20
- [elpa] externals/ampc e045d5a2fa 102/111: Remove ampc, then re-add, since I cannot find it anywhere else, Stefan Monnier, 2024/02/20
- [elpa] externals/ampc a98412698b 105/111: * ampc/ampc.el (ampc-views): Add "Search view", Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 4a2a2e642f 109/111: ; Prefer HTTPS to HTTP in URLs, Stefan Monnier, 2024/02/20
- [elpa] externals/ampc b15e6985a9 054/111: The package of ampc is ampc itself, not GNU Emacs. All files changed., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 1dda527e59 055/111: * ampc.el (ampc-item-mode-map): Clarify docs in regards to the arguments of, Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 1bc7428150 069/111: * ampc.el (ampc-handle-command): Handle mini-currentsong.,
Stefan Monnier <=
- [elpa] externals/ampc c41fde637d 073/111: * ampc.el (ampc-goto-current-song): Goto point-min if there is no song currently, Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 8e34ab9150 082/111: * ampc.el (ampc-update-playlist, ampc-fill-status, ampc-configure-frame), Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 3eaa022007 086/111: * ampc.el: Remove explicit easymenu requirement because it autoloads., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc b6bb73343d 099/111: * ampc.el: Bump version to 0.2., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 4ae66dfad8 059/111: * ampc.el (ampc-fill-skeleton): Add mouse highlighting for list entries., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 46143951ee 094/111: * ampc.el: Refine options for sending commands., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 68457ec2aa 021/111: Fix spelling mistake., Stefan Monnier, 2024/02/20