emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105769: * mpc.el (mpc-constraints-ta


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105769: * mpc.el (mpc-constraints-tag-lookup): New function.
Date: Wed, 14 Sep 2011 17:20:24 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105769
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2011-09-14 17:20:24 -0400
message:
  * 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".
modified:
  lisp/ChangeLog
  lisp/mpc.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-09-14 16:07:42 +0000
+++ b/lisp/ChangeLog    2011-09-14 21:20:24 +0000
@@ -1,3 +1,9 @@
+2011-09-14  Stefan Monnier  <address@hidden>
+
+       * 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  <address@hidden>
 
        * 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.

=== modified file 'lisp/mpc.el'
--- a/lisp/mpc.el       2011-08-24 01:55:10 +0000
+++ b/lisp/mpc.el       2011-09-14 21:20:24 +0000
@@ -1349,6 +1349,16 @@
         (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 @@
     (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]