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

    short name in the browser view
    
    I don't set it in the queue view because there is too much
    informations lost here for my taste.
---
 mpdired.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mpdired.el b/mpdired.el
index 8ff72340bb..d781c12378 100644
--- a/mpdired.el
+++ b/mpdired.el
@@ -153,16 +153,20 @@
 (defvar-local mpdired--queue-point nil
   "Saved point position in the queue view.")
 
+(defun mpdired--short-name (string)
+  (car (last (split-string string "/"))))
+
 (defun mpdired--insert-entry (entry)
   (let ((bol (line-beginning-position)))
     (cond ((stringp entry)
-          (insert entry)
+          (insert (mpdired--short-name entry))
           (put-text-property bol (line-end-position) 'type 'file)
           (put-text-property bol (line-end-position) 'uri entry))
          ((consp entry)
-          (insert (propertize (car entry) 'face 'dired-directory))
-          (put-text-property bol (line-end-position) 'type 'directory)
-          (put-text-property bol (line-end-position) 'uri (car entry))))))
+          (let ((dir (car entry)))
+            (insert (propertize (mpdired--short-name dir) 'face 
'dired-directory))
+            (put-text-property bol (line-end-position) 'type 'directory)
+            (put-text-property bol (line-end-position) 'uri dir))))))
 
 (defun mpdired--insert-song (song)
   (let ((id (car song))

Reply via email to