]> git.eshelyaron.com Git - emacs.git/commitdiff
* mpc.el (mpc-constraints-tag-lookup): New function.
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 14 Sep 2011 21:20:24 +0000 (17:20 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 14 Sep 2011 21:20:24 +0000 (17:20 -0400)
(mpc-constraints-restore): Use it to make jumping to "album=Foo" apply
also to browser "album|playlist".

lisp/ChangeLog
lisp/mpc.el

index 1a70c0c3f0771f0b4de3dff75896f62d6434644e..aa8eddae085836bb39d6edcd45e69a57cf55bebc 100644 (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.
index 932fb5926fd0c02d999cb38c63c42446a0d9854c..8854d4e908f07079c6147837921a07f42d5b49a4 100644 (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