aboutsummaryrefslogtreecommitdiff
path: root/lisp/emms-cache.el
diff options
context:
space:
mode:
authorPierre Neidhardt <ambrevar@gmail.com>2018-04-09 16:13:30 +0530
committerPierre Neidhardt <ambrevar@gmail.com>2018-04-09 23:09:34 +0530
commitca4a9e559d48bda94311afd17918a92a27c69abd (patch)
treeeca5a6fc729a26bb2031492d5081b6f7123bb21e /lisp/emms-cache.el
parentd4ba37fcab1ad377319c52a8131de32cf9d306d7 (diff)
* lisp/emms-cache.el: Add the `emms-cache-reset' function for convenience
It can be useful sometimes to reset the cache: - Whenever too many undesirable tracks have populated the collection, it's faster to reset and re-add only the desired tracks. - Whenever it gets corrupted (it ideally should not...).
Diffstat (limited to 'lisp/emms-cache.el')
-rw-r--r--lisp/emms-cache.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/emms-cache.el b/lisp/emms-cache.el
index 4e45eda..792b1b8 100644
--- a/lisp/emms-cache.el
+++ b/lisp/emms-cache.el
@@ -179,5 +179,17 @@ been modified."
(setq emms-cache-dirty t)))
(message "Syncing emms track cache...done"))
+(defun emms-cache-reset ()
+ "Reset the cache."
+ (interactive)
+ (when (yes-or-no-p "Really reset the cache?")
+ (setq emms-cache-db
+ (make-hash-table
+ :test (if (fboundp 'define-hash-table-test)
+ 'string-hash
+ 'equal)))
+ (setq emms-cache-dirty t)
+ (emms-cache-save)))
+
(provide 'emms-cache)
;;; emms-cache.el ends here