From accfde0f1a53e921406bb352fc5c3081ef9dbe97 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 2 Jul 2006 00:12:00 +0000 Subject: Make emms-cache and emms-browser work with XEmacs. darcs-hash:20060702001247-1bfb2-987d207f3c007211aae68e8061a2a16fdc6960a7.gz --- emms-browser.el | 11 +++++++---- emms-cache.el | 9 +++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/emms-browser.el b/emms-browser.el index 76d4e58..d642575 100644 --- a/emms-browser.el +++ b/emms-browser.el @@ -127,7 +127,9 @@ adding an album, artist, etc." :type 'function) (defcustom emms-browser-comparison-test - 'case-fold + (if (fboundp 'define-hash-table-test) + 'case-fold + 'equal) "*A method for comparing entries in the cache. The default is to compare case-insensitively." :group 'emms-browser @@ -396,7 +398,7 @@ compilations, etc." (defun emms-browser-make-hash-by (type) "Make a hash, mapping with TYPE, eg artist -> tracks." (let ((hash (make-hash-table - :test emms-browser-comparison-test)) + :test emms-browser-comparison-test)) field existing-entry) (maphash (lambda (path track) (setq field (emms-browser-get-track-field track type)) @@ -422,8 +424,9 @@ compilations, etc." (defun case-fold-string-hash (a) (sxhash (upcase a))) -(define-hash-table-test 'case-fold - 'case-fold-string= 'case-fold-string-hash) +(when (fboundp 'define-hash-table-test) + (define-hash-table-test 'case-fold + 'case-fold-string= 'case-fold-string-hash)) (defun emms-browser-insert-top-level-entry (name tracks type) "Insert a single top level entry into the buffer." diff --git a/emms-cache.el b/emms-cache.el index fa5bacf..441e70e 100644 --- a/emms-cache.el +++ b/emms-cache.el @@ -42,8 +42,13 @@ (require 'emms) -(define-hash-table-test 'string-hash 'string= 'sxhash) -(defvar emms-cache-db (make-hash-table :test 'string-hash) +(when (fboundp 'define-hash-table-test) + (define-hash-table-test 'string-hash 'string= 'sxhash)) + +(defvar emms-cache-db (make-hash-table + :test (if (fboundp 'define-hash-table-test) + 'string-hash + 'equal)) "A mapping of paths to file info. This is used to cache over emacs sessions.") -- cgit v1.2.3