branch: externals/mpdired
commit adf0efb64d0e3efc712cd4d3b02a6dc9bc07575d
Author: Manuel Giraud <man...@ledu-giraud.fr>
Commit: Manuel Giraud <man...@ledu-giraud.fr>

    fix `mpdired--subdir-p'
    
    `mpdired--subdir-p' falsely returned t for sibling directory names
    where one is a substring of the other. For instance:
       Artist A/Album
       Artist A/Album 2
    
    In such case, "Album 2" would not appear in the browser view.
---
 mpdired.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mpdired.el b/mpdired.el
index 279a811c50..ad9fac1840 100644
--- a/mpdired.el
+++ b/mpdired.el
@@ -186,8 +186,8 @@
 
 (defun mpdired--subdir-p (dir-a dir-b)
   "Is DIR-B a sub-directory of DIR-A?"
-  (let ((pos (string-search dir-a dir-b)))
-    (and pos (zerop pos))))
+  (or (string-empty-p dir-a)
+      (string-prefix-p (concat dir-a "/") dir-b)))
 
 (defvar mpdired--eot "^\\(OK\\|ACK.*\\)$"
   "Regexp for end of transmission of a MPD command.")

Reply via email to