* mpc.el (mpc-constraints-tag-lookup): New function.

(mpc-constraints-restore): Use it to make jumping to "album=Foo" apply
also to browser "album|playlist".
This commit is contained in:
Stefan Monnier 2011-09-14 17:20:24 -04:00
parent 7277997612
commit d3c309545b
2 changed files with 20 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2011-09-14 Stefan Monnier <monnier@iro.umontreal.ca>
* mpc.el (mpc-constraints-tag-lookup): New function.
(mpc-constraints-restore): Use it to make jumping to "album=Foo" apply
also to browser "album|playlist".
2011-09-14 Juri Linkov <juri@jurta.org>
* isearch.el (isearch-fail-pos): Add new arg `msg'. Doc fix.
@ -21,8 +27,8 @@
(display-buffer-function, special-display-buffer-names)
(special-display-function): Mention help-setup parameter instead
of display-buffer-window in doc-string.
* help.el (help-window-setup): New argument help-window. Use
help-window-setup parameter instead of display-buffer-window.
* help.el (help-window-setup): New argument help-window.
Use help-window-setup parameter instead of display-buffer-window.
Reword some messages.
(with-help-window): Pass window used for displaying the buffer
to help-window-setup. Don't set display-buffer-window.

View file

@ -1349,6 +1349,16 @@ when constructing the set of constraints."
(push (cons tag select) constraints)))
constraints))
(defun mpc-constraints-tag-lookup (buffer-tag constraints)
(let (res)
(dolist (constraint constraints)
(when (or (eq (car constraint) buffer-tag)
(and (string-match "|" (symbol-name buffer-tag))
(member (symbol-name (car constraint))
(split-string (symbol-name buffer-tag) "|"))))
(setq res (cdr constraint))))
res))
(defun mpc-constraints-restore (constraints)
(let ((search (assq 'Search constraints)))
(setq mpc--song-search (cadr search))
@ -1357,10 +1367,10 @@ when constructing the set of constraints."
(setq buf (cdr buf))
(when (buffer-live-p buf)
(let* ((tag (buffer-local-value 'mpc-tag buf))
(constraint (assq tag constraints)))
(constraint (mpc-constraints-tag-lookup tag constraints)))
(when tag
(with-current-buffer buf
(mpc-select-restore (cdr constraint)))))))
(mpc-select-restore constraint))))))
(mpc-selection-refresh))
;; I don't get the ring.el code. I think it doesn't do what I need, but