From 692400a23be7cc13834140638d8d69188917c8f7 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 4 Jun 2006 19:49:00 +0000 Subject: Make sure we never have an empty track description when inserting a song into a playlist buffer. darcs-hash:20060604194940-1bfb2-8e8a20dde4b8c3fc89f5dd0552207cb5f3441429.gz --- emms.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'emms.el') 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"))) -- cgit v1.2.3