[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ampc effd06f0d8 072/111: * ampc.el: Add mouse support f
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ampc effd06f0d8 072/111: * ampc.el: Add mouse support for playlist commands. |
Date: |
Tue, 20 Feb 2024 18:16:41 -0500 (EST) |
branch: externals/ampc
commit effd06f0d8939017f75f0848fbc0258a427f6754
Author: Christopher Schmidt <christopher@ch.ristopher.com>
Commit: Christopher Schmidt <christopher@ch.ristopher.com>
* ampc.el: Add mouse support for playlist commands.
(ampc-current-playlist-mode-map, ampc-playlist-mode-map)
(ampc-playlists-mode-map): Add commands.
(ampc-playlist, ampc-load, ampc-delete-playlist): Add optional argument
at-point.
(ampc-fill-playlist): Use the right buffer when padding the entries.
(ampc-mouse-delete-playlist, ampc-mouse-load): New commands.
---
ampc.el | 66 +++++++++++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 48 insertions(+), 18 deletions(-)
diff --git a/ampc.el b/ampc.el
index 9da57aefda..7f41be5e60 100644
--- a/ampc.el
+++ b/ampc.el
@@ -133,6 +133,10 @@
;; stored playlists is the only view in ampc that may have only one marked
;; entry.
;;
+;; To queue a playlist, press `l' (ampc-load) or `<down-mouse-2>'. To delete a
+;; playlist, press `d' (ampc-delete-playlist) or `<down-mouse-3>'. The command
+;; `ampc-rename-playlist', bound to `r', can be used to rename a playlist.
+;;
;; Again, the key `<' may be used to setup a playlist view with a different
;; order of tag browsers.
@@ -435,6 +439,7 @@ all the time!"
(define-key map (kbd "<down-mouse-2>") 'ampc-mouse-play-this)
(define-key map (kbd "<mouse-2>") 'ampc-mouse-align-point)
(define-key map (kbd "<down-mouse-3>") 'ampc-mouse-delete)
+ (define-key map (kbd "<mouse-3>") 'ampc-mouse-align-point)
map))
(defvar ampc-playlist-mode-map
@@ -445,6 +450,7 @@ all the time!"
(define-key map (kbd "<up>") 'ampc-up)
(define-key map (kbd "<down>") 'ampc-down)
(define-key map (kbd "<down-mouse-3>") 'ampc-mouse-delete)
+ (define-key map (kbd "<mouse-3>") 'ampc-mouse-align-point)
map))
(defvar ampc-playlists-mode-map
@@ -453,6 +459,10 @@ all the time!"
(define-key map (kbd "l") 'ampc-load)
(define-key map (kbd "r") 'ampc-rename-playlist)
(define-key map (kbd "d") 'ampc-delete-playlist)
+ (define-key map (kbd "<down-mouse-2>") 'ampc-mouse-load)
+ (define-key map (kbd "<mouse-2>") 'ampc-mouse-align-point)
+ (define-key map (kbd "<down-mouse-3>") 'ampc-mouse-delete-playlist)
+ (define-key map (kbd "<mouse-3>") 'ampc-mouse-align-point)
map))
(defvar ampc-tag-song-mode-map
@@ -828,9 +838,10 @@ all the time!"
((> (prefix-numeric-value arg) 0) 1)
(t 0)))))
-(defun ampc-playlist ()
+(defun ampc-playlist (&optional at-point)
(ampc-with-buffer 'playlists
- (if (search-forward-regexp "^* \\(.*\\)$" nil t)
+ (if (and (not at-point)
+ (search-forward-regexp "^* \\(.*\\)$" nil t))
(match-string 1)
(unless (eobp)
(buffer-substring-no-properties
@@ -1114,12 +1125,11 @@ all the time!"
do (save-restriction
(setf next (ampc-narrow-entry))
(let ((file (ampc-extract "file"))
- (text (ampc-pad (loop for (tag . tag-properties) in
properties
- collect (or (ampc-extract tag)
- "[Not Specified]"))
- 2)))
+ (pad-data (loop for (tag . tag-properties) in properties
+ collect (or (ampc-extract tag)
+ "[Not Specified]"))))
(ampc-with-buffer 'playlist
- (ampc-insert text
+ (ampc-insert (ampc-pad pad-data 2)
`(("file" . ,file)
(index . ,i))
(lambda (a b)
@@ -1603,6 +1613,18 @@ all the time!"
(goto-char (posn-point (event-end event)))
(ampc-add-impl))
+(defun ampc-mouse-delete-playlist (event)
+ (interactive "e")
+ (select-window (posn-window (event-end event)))
+ (goto-char (posn-point (event-end event)))
+ (ampc-delete-playlist t))
+
+(defun ampc-mouse-load (event)
+ (interactive "e")
+ (select-window (posn-window (event-end event)))
+ (goto-char (posn-point (event-end event)))
+ (ampc-load t))
+
(defun ampc-mouse-toggle-output-enabled (event)
(interactive "e")
(select-window (posn-window (event-end event)))
@@ -1808,13 +1830,17 @@ Interactively, read NEW-NAME from the minibuffer."
(ampc-send-command 'rename nil (ampc-playlist) new-name)
(error "No playlist selected")))
-(defun ampc-load ()
- "Load selected playlist in the current playlist."
+(defun ampc-load (&optional at-point)
+ "Load selected playlist in the current playlist.
+If optional argument AT-POINT is non-nil (or if no playlist is
+selected), use playlist at point rather than the selected one."
(interactive)
(assert (ampc-in-ampc-p))
- (if (ampc-playlist)
- (ampc-send-command 'load nil (ampc-quote (ampc-playlist)))
- (error "No playlist selected")))
+ (if (ampc-playlist at-point)
+ (ampc-send-command 'load nil (ampc-quote (ampc-playlist at-point)))
+ (if at-point
+ (error "No playlist at point")
+ (error "No playlist selected"))))
(defun ampc-toggle-output-enabled (&optional arg)
"Toggle the next ARG outputs.
@@ -1928,14 +1954,18 @@ have enough information yet."
(message "%s" status))
status))
-(defun ampc-delete-playlist ()
- "Delete selected playlist."
+(defun ampc-delete-playlist (&optional at-point)
+ "Delete selected playlist.
+If optional argument AT-POINT is non-nil (or if no playlist is
+selected), use playlist at point rather than the selected one."
(interactive)
(assert (ampc-in-ampc-p))
- (ampc-with-selection nil
- (let ((name (get-text-property (point) 'data)))
- (when (y-or-n-p (concat "Delete playlist " name "?"))
- (ampc-send-command 'rm nil (ampc-quote name))))))
+ (if (ampc-playlist at-point)
+ (when (y-or-n-p (concat "Delete playlist " (ampc-playlist at-point) "?"))
+ (ampc-send-command 'rm nil (ampc-quote (ampc-playlist at-point))))
+ (if at-point
+ (error "No playlist at point")
+ (error "No playlist selected"))))
(defun ampc-store (name)
"Store current playlist as NAME.
- [elpa] externals/ampc 26c78cf4a5 108/111: * ampc.el: Fix compilation warnings, (continued)
- [elpa] externals/ampc 26c78cf4a5 108/111: * ampc.el: Fix compilation warnings, Stefan Monnier, 2024/02/20
- [elpa] externals/ampc b89aa28b49 001/111: Initial commit., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc e301604aa0 012/111: Add commentary and code tags., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc ac831c4f29 018/111: Rebuild internal song database if the tag browser change., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 84efcaa16d 044/111: * ampc: Bump version to 0.1.2., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc bdb75f9ab9 051/111: * ampc.el (ampc-mode-map): Add checkboxes to the toggle menu items., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc 3c81462de0 058/111: * ampc.el: Add tool-bar., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc c3c36d6a5e 060/111: * ampc.el: Add mouse support., Stefan Monnier, 2024/02/20
- [elpa] externals/ampc f0462f2d8c 061/111: * ampc.el (ampc): Change the name of the internal communication buffer to, Stefan Monnier, 2024/02/20
- [elpa] externals/ampc bb5ba9b2bb 068/111: * ampc.el: Add ampc-mini, a command to select the song to play via, Stefan Monnier, 2024/02/20
- [elpa] externals/ampc effd06f0d8 072/111: * ampc.el: Add mouse support for playlist commands.,
Stefan Monnier <=
- [elpa] externals/ampc cd2a3a93a6 074/111: * ampc.el: Doc simplifications., Stefan Monnier, 2024/02/20
- [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