(mpc-cmd-find): Try and fix bug#41493
* lisp/mpc.el (mpc--proc-alist-to-alists): Don't presume that we have either `directory` or `file` entries, instead allow both at the same time. (mpc-cmd-find) <Directory>: Don't presume that `directory` entries have no associated data, so throw them away only after having parsed them with `mpc--proc-alist-to-alists`.
This commit is contained in:
parent
e0b4e9ece9
commit
3740d9c838
1 changed files with 13 additions and 11 deletions
24
lisp/mpc.el
24
lisp/mpc.el
|
@ -310,13 +310,15 @@ PORT defaults to 6600 and HOST defaults to localhost."
|
|||
(defconst mpc--proc-alist-to-alists-starters '(file directory))
|
||||
|
||||
(defun mpc--proc-alist-to-alists (alist)
|
||||
;; ALIST is assumed to contain a flattened sequence of sequences,
|
||||
;; of the form (file . ..) ..filedata.. (directory . ..) ..dirdata..
|
||||
;; See bug#41493.
|
||||
(cl-assert (or (null alist)
|
||||
(memq (caar alist) mpc--proc-alist-to-alists-starters)))
|
||||
(let ((starter (caar alist))
|
||||
(alists ())
|
||||
(let ((alists ())
|
||||
tmp)
|
||||
(dolist (pair alist)
|
||||
(when (eq (car pair) starter)
|
||||
(when (memq (car pair) mpc--proc-alist-to-alists-starters)
|
||||
(if tmp (push (nreverse tmp) alists))
|
||||
(setq tmp ()))
|
||||
(push pair tmp))
|
||||
|
@ -638,15 +640,15 @@ The songs are returned as alists."
|
|||
(mpc-proc-buf-to-alists
|
||||
(mpc-proc-cmd (list "search" "any" value))))
|
||||
((eq tag 'Directory)
|
||||
(let ((pairs
|
||||
(mpc-proc-buf-to-alist
|
||||
(let ((entries
|
||||
(mpc-proc-buf-to-alists
|
||||
(mpc-proc-cmd (list "listallinfo" value)))))
|
||||
(mpc--proc-alist-to-alists
|
||||
;; Strip away the `directory' entries.
|
||||
(delq nil (mapcar (lambda (pair)
|
||||
(if (eq (car pair) 'directory)
|
||||
nil pair))
|
||||
pairs)))))
|
||||
;; Strip away the `directory' entries because our callers
|
||||
;; currently don't know what to do with them.
|
||||
(delq nil (mapcar (lambda (entry)
|
||||
(if (eq (caar entry) 'directory)
|
||||
nil entry))
|
||||
entries))))
|
||||
((string-match "|" (symbol-name tag))
|
||||
(add-to-list 'mpc--find-memoize-union-tags tag)
|
||||
(let ((tag1 (intern (substring (symbol-name tag)
|
||||
|
|
Loading…
Add table
Reference in a new issue