aboutsummaryrefslogtreecommitdiff
path: root/emms.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2006-06-04 19:49:00 +0000
committerMichael Olson <mwolson@gnu.org>2006-06-04 19:49:00 +0000
commit692400a23be7cc13834140638d8d69188917c8f7 (patch)
tree6c3ae546790bfa4f783181bb6a10b2ea31989695 /emms.el
parent12d4527033257c37e633a1990dc84e2a1ca7f6fb (diff)
Make sure we never have an empty track description when inserting a song into a playlist buffer.
darcs-hash:20060604194940-1bfb2-8e8a20dde4b8c3fc89f5dd0552207cb5f3441429.gz
Diffstat (limited to 'emms.el')
-rw-r--r--emms.el17
1 files changed, 14 insertions, 3 deletions
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")))