[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mpdired 9690720c32 099/133: starts supporting playlist
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mpdired 9690720c32 099/133: starts supporting playlist |
Date: |
Sun, 10 Mar 2024 15:59:39 -0400 (EDT) |
branch: externals/mpdired
commit 9690720c32bfbf6e35e0e7948dbd2255050d86b9
Author: Manuel Giraud <manuel@ledu-giraud.fr>
Commit: Manuel Giraud <manuel@ledu-giraud.fr>
starts supporting playlist
Only in browse view. No real support yet.
---
mpdired.el | 82 ++++++++++++++++++++++++++++++++++++++------------------------
1 file changed, 50 insertions(+), 32 deletions(-)
diff --git a/mpdired.el b/mpdired.el
index 83ff47b700..79d850ed40 100644
--- a/mpdired.el
+++ b/mpdired.el
@@ -132,6 +132,10 @@
'((t :inherit dired-directory))
"Face used to show a directory.")
+(defface mpdired-playlist
+ '((t :inherit dired-symlink))
+ "Face used to show a playlist.")
+
(defface mpdired-marked
'((t :inherit dired-marked))
"Face used to show a marked entry.")
@@ -140,10 +144,6 @@
'((t :inherit dired-flagged))
"Face used to show an entry flagged for deletion.")
-(defun mpdired--subdir-p (dir-a dir-b)
- (let ((pos (string-search dir-a dir-b)))
- (and pos (zerop pos))))
-
;; State variables for the communication buffer
(defvar-local mpdired--network-params nil)
(defvar-local mpdired--parse-endp nil)
@@ -153,6 +153,10 @@
(defvar-local mpdired--ascending-p nil)
(defvar-local mpdired--message nil)
+(defun mpdired--subdir-p (dir-a dir-b)
+ (let ((pos (string-search dir-a dir-b)))
+ (and pos (zerop pos))))
+
(defun mpdired--parse-listall-1 (current accum)
;; Recursively rebuild the directory hierarchy from a "listall"
;; command into a list. In the output, a directory is list which
@@ -163,24 +167,26 @@
(setq mpdired--parse-endp
(re-search-forward "^\\(OK\\|ACK.*\\)$"
(line-end-position) t 1))))
- ;; Look for file or directory line by line (I'm not interested
- ;; in playlist)
- (re-search-forward "^\\(file\\|directory\\): \\(.*\\)$"
- (line-end-position) t 1)
- (let ((type (match-string 1))
- (new (match-string 2)))
- (cond ((string= "file" type) (push new accum))
- ((string= "directory" type)
- ;; This new directory is either a subdir of the current
- ;; one or a new directory of the same level of the
- ;; current one. In this last case we need to go one
- ;; line backward (because we will go forward later) and
- ;; quit the loop.
- (cond ((mpdired--subdir-p current new)
- (forward-line)
- (push (mpdired--parse-listall-1 new (list new)) accum))
- (t (forward-line -1)
- (throw 'exit t))))))
+ ;; Look for file, playlist or directory line by line.
+ (when
+ (re-search-forward "^\\(file\\|playlist\\|directory\\): \\(.*\\)$"
+ (line-end-position) t 1)
+ (let ((type (match-string 1))
+ (name (match-string 2)))
+ (cond ((or (string= "file" type)
+ (string= "playlist" type))
+ (push (cons (intern type) name) accum))
+ ((string= "directory" type)
+ ;; This new directory is either a subdir of the current
+ ;; one or a new directory of the same level of the
+ ;; current one. In this last case we need to go one
+ ;; line backward (because we will go forward later) and
+ ;; quit the loop.
+ (cond ((mpdired--subdir-p current name)
+ (forward-line)
+ (push (mpdired--parse-listall-1 name (list name))
accum))
+ (t (forward-line -1)
+ (throw 'exit t)))))))
(forward-line)))
(reverse accum))
@@ -336,15 +342,23 @@
"Insert ENTRY in MPDired browser view."
(insert " ")
(let ((bol (mpdired--bol)))
- (cond ((stringp entry)
- (insert (mpdired--short-name entry))
- (put-text-property bol (line-end-position) 'type 'file)
- (put-text-property bol (line-end-position) 'uri entry))
- ((consp entry)
- (let ((dir (car entry)))
- (insert (propertize (mpdired--short-name dir) 'face
'mpdired-directory))
- (put-text-property bol (line-end-position) 'type 'directory)
- (put-text-property bol (line-end-position) 'uri dir))))
+ (when (consp entry)
+ (let ((type (car entry)))
+ (cond ((stringp type) ;; this is a directory
+ (insert (propertize (mpdired--short-name type) 'face
'mpdired-directory))
+ (put-text-property bol (line-end-position) 'type 'directory)
+ (put-text-property bol (line-end-position) 'uri type))
+ ((eq type 'file)
+ (let ((file (cdr entry)))
+ (insert (mpdired--short-name file))
+ (put-text-property bol (line-end-position) 'type 'file)
+ (put-text-property bol (line-end-position) 'uri file)))
+ ((eq type 'playlist)
+ (let ((playlist (cdr entry)))
+ (insert (propertize (mpdired--short-name playlist)
+ 'face 'mpdired-playlist))
+ (put-text-property bol (line-end-position) 'type 'playlist)
+ (put-text-property bol (line-end-position) 'uri playlist))))))
(insert "\n")))
(defun mpdired--insert-status ()
@@ -559,7 +573,11 @@ an optional communication buffer."
(mpdired--with-comm-buffer process nil
(setq mpdired--last-command 'listall
mpdired--ascending-p ascending-p)
- (process-send-string process (format "listall \"%s\"\n" path))))
+ (process-send-string process "command_list_begin\n")
+ (when (string= "" path)
+ (process-send-string process "listplaylists\n"))
+ (process-send-string process (format "listall \"%s\"\n" path))
+ (process-send-string process "command_list_end\n")))
(defun mpdired-queue-internal (&optional buffer)
(mpdired--with-comm-buffer process buffer
- [elpa] externals/mpdired 5363e1565c 132/133: drop copyright to FSF, (continued)
- [elpa] externals/mpdired 5363e1565c 132/133: drop copyright to FSF, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 0bead27006 065/133: fix bol positioning in some case, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 384bcbaf87 072/133: message is already reset when displayed, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 6df5870a7d 067/133: try to go to a correct place upon deletion, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired f5e5350ac0 070/133: unmark all marks, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 6c846ec87d 080/133: message for pause, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 2be9c24398 075/133: use the function reader macro, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 2ac5d2f759 095/133: more text, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 3f6a3bec12 091/133: copy mpd's status in a buffer local var, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired ba9a99a004 104/133: fix view toggle, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 9690720c32 099/133: starts supporting playlist,
ELPA Syncer <=
- [elpa] externals/mpdired b7343a00ca 100/133: playlist browsing, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 3198436ba6 105/133: quote URI in messages, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 1c0bdfde99 110/133: more comment, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired d99e1597de 124/133: s/dolist/mapc for trivial with side effects, ELPA Syncer, 2024/03/10
- [elpa] externals/mpdired 7ba0077315 129/133: avoid consing in `mpdired--short-name', ELPA Syncer, 2024/03/10