branch: externals/emms
commit bd5e088932b64f499e4f51c53f176abd4b859895
Author: Erica Lina <erical...@proton.me>
Commit: Erica Lina <erical...@proton.me>

    Rearrange the empty hash messages so that they are more precise.
---
 emms-browser.el | 23 ++++++++++++-----------
 emms-filters.el | 29 ++++++++++++++++++++++++++---
 2 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/emms-browser.el b/emms-browser.el
index f64db5c167..56a3991a3b 100644
--- a/emms-browser.el
+++ b/emms-browser.el
@@ -199,6 +199,7 @@
 (require 'sort)
 (require 'seq)
 (require 'emms-filters)
+(require 'emms-cache)
 
 
 ;; --------------------------------------------------
@@ -613,8 +614,11 @@ or the default-browse-type"
     (setq emms-browser-top-level-type type)
 
     (goto-char (point-min))
-    (unless (> (hash-table-count hash) 0)
-      (emms-browser-show-empty-cache-message)) ))
+
+    (if (not (> (hash-table-count hash) 0))
+        (if (emms-filters-is-filtering)
+            (emms-browser-show-empty-result-message)
+          (emms-browser-show-empty-cache-message)))))
 
 (emms-browser-add-category "albumartist" 'info-albumartist)
 (emms-browser-add-category "artist" 'info-artist)
@@ -722,19 +726,16 @@ For \\='info-year TYPE, use \\='info-originalyear, 
\\='info-originaldate and
   (let ((bdata (emms-browser-make-bdata-tree type 1 tracks name)))
     (emms-browser-insert-format bdata)))
 
+(defun emms-browser-show-empty-result-message ()
+  "Display some help if the cache-db exists but the result hash is empty."
+  (emms-with-inhibit-read-only-t
+   (insert (emms-filters-empty-result-message))))
+
 (defun emms-browser-show-empty-cache-message ()
   "Display some help if the cache is empty."
   (emms-with-inhibit-read-only-t
-   (insert (emms-filters-empty-result-message))
    (insert "
-You may have created a filter with no results found.
-If this is the case you may return to your previous
-filter by popping the current filter with 'f q'.
-If you happen to have an empty search cache on
-the cache stack you can pop it from the stack with 'c q'.
-
-
-Otherwise, Welcome to EMMS.
+Welcome to EMMS.
 
 There are currently no files in the EMMS database.
 To browse music, you need to tell EMMS where your
diff --git a/emms-filters.el b/emms-filters.el
index 7ac1ede01a..2eaff8aa8c 100644
--- a/emms-filters.el
+++ b/emms-filters.el
@@ -1815,13 +1815,36 @@ or the emms-filters-filter-factory `search-fields'."
   "Give the current length of the search cache stack."
   (length emms-filters-search-caches))
 
+(defun emms-filters-is-filtering ()
+  "True if there is a search stack or a filter stack or a ring-filter."
+  (if (or (> (length emms-filters-search-caches) 0)
+          (> (length emms-filters-stack) 0)
+          (if emms-filters-current-ring-filter t nil))
+      t
+    nil))
+
 (defun emms-filters-empty-result-message ()
   "Display some help if the results are empty."
-  (concat "No records match with the current search cache and filters.\n"
-          (format "Cache: %s\n Ring: %s\n Filter: %s\n"
+  (concat "No records match with the current search cache and filters.\n\n"
+          (format "Cache: %s\nRing: %s\nFilter: %s\n\nEMMS Cache size: %s \n"
                   (emms-filters-current-cache-name)
                   (emms-filters-current-ring-filter-name)
-                  (car emms-filters-current-filter))))
+                  (car emms-filters-current-filter)
+                  (hash-table-count emms-cache-db))
+          "
+You may have created a filter with no results found.
+If this is the case you may return to your previous
+filter by popping the current filter.
+
+You may also have an empty search cache on
+the cache stack, popping or stashing and popping
+the current searche cache may yield results.
+
+You may also have selected a filter
+in the filter ring which has no matches.
+Move your filter ring selection to 'no filter'
+or select a different filter for different results."))
+
 
 (defun emms-filters-search-by (filter-factory-name)
   "Search using FILTER-FACTORY-NAME to create a filter.

Reply via email to