aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emms-playlist-mode.el2
-rw-r--r--emms.el17
2 files changed, 15 insertions, 4 deletions
diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el
index 4f6ac2a..307ede0 100644
--- a/emms-playlist-mode.el
+++ b/emms-playlist-mode.el
@@ -453,7 +453,7 @@ This preserves the current EMMS buffer."
When NO-NEWLINE is non-nil, do not insert a newline after the track."
(emms-playlist-ensure-playlist-buffer)
(emms-with-inhibit-read-only-t
- (insert (emms-propertize (emms-track-description track)
+ (insert (emms-propertize (emms-track-force-description track)
'emms-track track))
(save-restriction
(widen)
diff --git a/emms.el b/emms.el
index 02ce9dd..fa31e82 100644
--- a/emms.el
+++ b/emms.el
@@ -493,8 +493,19 @@ Otherwise, return the type and the name with a colon in between."
(if (eq 'file (emms-track-type track))
(emms-track-name track)
(concat (symbol-name (emms-track-type track))
- ":"
- (emms-track-name track))))
+ ": " (emms-track-name track))))
+
+(defun emms-track-force-description (track)
+ "Always return text that describes TRACK.
+This is used when inserting a description into a buffer.
+
+The reason for this is that if no text was returned (i.e. the
+user defined a track function that returned nil or the empty
+string), a confusing error message would result."
+ (let ((desc (emms-track-description track)))
+ (if (and (stringp desc) (not (string= desc "")))
+ desc
+ (emms-track-simple-description track))))
;;; The Playlist
@@ -905,7 +916,7 @@ This is supplying ARGS as arguments to the source."
"Insert the description of TRACK at point."
(emms-playlist-ensure-playlist-buffer)
(let ((inhibit-read-only t))
- (insert (emms-propertize (emms-track-description track)
+ (insert (emms-propertize (emms-track-force-description track)
'emms-track track)
"\n")))