aboutsummaryrefslogtreecommitdiff
path: root/emms-score.el
diff options
context:
space:
mode:
Diffstat (limited to 'emms-score.el')
-rw-r--r--emms-score.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/emms-score.el b/emms-score.el
index f9e520e..e8d066f 100644
--- a/emms-score.el
+++ b/emms-score.el
@@ -242,12 +242,15 @@ See also `emms-next-noerror'."
(defun emms-score-load-hash ()
"Load score hash from `emms-score-file'."
(interactive)
- (mapc (lambda (elt)
- (puthash (car elt) (cdr elt) emms-score-hash))
- (read
- (with-temp-buffer
- (insert-file-contents emms-score-file)
- (buffer-string)))))
+ (if (file-exists-p emms-score-file)
+ (mapc (lambda (elt)
+ (puthash (car elt) (cdr elt) emms-score-hash))
+ (read
+ (with-temp-buffer
+ (insert-file-contents emms-score-file)
+ (buffer-string))))
+ ;; when file not exists, make empty but valid score file
+ (emms-score-save-hash)))
(defun emms-score-get-plist (filename)
(gethash filename emms-score-hash))