From d3c309545b668fd69fea7d324ece194018e9d224 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 14 Sep 2011 17:20:24 -0400 Subject: [PATCH] * 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". --- lisp/ChangeLog | 10 ++++++++-- lisp/mpc.el | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1a70c0c3f07..aa8eddae085 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-09-14 Stefan Monnier + + * 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 * 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. diff --git a/lisp/mpc.el b/lisp/mpc.el index 932fb5926fd..8854d4e908f 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -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 -- 2.39.2