diff options
-rw-r--r-- | emms.el | 60 |
1 files changed, 30 insertions, 30 deletions
@@ -487,6 +487,36 @@ See `emms-repeat-track'." (require 'emms-compat) +;;; Dictionaries + +;; This is a simple helper data structure, used by both players +;; and tracks. + +(defsubst emms-dictionary (name) + "Create a new dictionary of type NAME." + (list name)) + +(defsubst emms-dictionary-type (dict) + "Return the type of the dictionary DICT." + (car dict)) + +(defun emms-dictionary-get (dict name &optional default) + "Return the value of NAME in DICT." + (let ((item (assq name (cdr dict)))) + (if item + (cdr item) + default))) + +(defun emms-dictionary-set (dict name value) + "Set the value of NAME in DICT to VALUE." + (let ((item (assq name (cdr dict)))) + (if item + (setcdr item value) + (setcdr dict (append (cdr dict) + (list (cons name value)))))) + dict) + + ;;; Tracks ;; This is a simple datatype to store track information. @@ -1338,35 +1368,5 @@ or negative to seek backwards." (funcall seek seconds) (run-hook-with-args 'emms-player-time-set-functions seconds))))) - -;;; Dictionaries - -;; This is a simple helper data structure, used by both players -;; and tracks. - -(defsubst emms-dictionary (name) - "Create a new dictionary of type NAME." - (list name)) - -(defsubst emms-dictionary-type (dict) - "Return the type of the dictionary DICT." - (car dict)) - -(defun emms-dictionary-get (dict name &optional default) - "Return the value of NAME in DICT." - (let ((item (assq name (cdr dict)))) - (if item - (cdr item) - default))) - -(defun emms-dictionary-set (dict name value) - "Set the value of NAME in DICT to VALUE." - (let ((item (assq name (cdr dict)))) - (if item - (setcdr item value) - (setcdr dict (append (cdr dict) - (list (cons name value)))))) - dict) - (provide 'emms) ;;; emms.el ends here |