From 6e0e5a6961e8d0454664e832d69dabf3a9917549 Mon Sep 17 00:00:00 2001 From: "william.xwl" Date: Tue, 4 Oct 2005 16:21:00 +0000 Subject: emms-mode-line.el: When artist or title info cann't be achieved, show file name without directory. darcs-hash:20051004162138-e8fe6-dbbeb40bb623c61ac9a1051afcd8c12e4dc11553.gz --- emms-mode-line.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/emms-mode-line.el b/emms-mode-line.el index fd84d57..e4c201f 100644 --- a/emms-mode-line.el +++ b/emms-mode-line.el @@ -53,9 +53,19 @@ (defun emms-mode-line-playlist-current () "Format the currently playing song" - (format emms-mode-line-format - (emms-track-description - (emms-playlist-current-selected-track)))) + (format + emms-mode-line-format + (let* ((track (emms-playlist-current-selected-track)) + (artist (emms-track-get track 'info-artist)) + (title (emms-track-get track 'info-title)) + (type (emms-track-type track))) + ;; when artist or title info cann't be achieved, show file name + ;; without directory. + (if (and (not (and artist title)) + (eq 'file type)) + (file-name-nondirectory (emms-track-name track)) + (emms-track-description + (emms-playlist-current-selected-track)))))) (defvar emms-mode-line-initial-titlebar frame-title-format) -- cgit v1.2.3