aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2007-01-29 09:13:00 +0000
committerMichael Olson <mwolson@gnu.org>2007-01-29 09:13:00 +0000
commitdc1f3f03fbc62baa6da7112cbdf23b9b3d50b661 (patch)
treeb7663e8be4fe3734e93bbb3d446232957ec9e8f9
parent5cf0ca5712443a452b77233440bb9e2cc103b6ec (diff)
Distinguish `emms-track-description' and `emms-track-force-description'
The idea is that emms-track-force-description is only allowed to be used when inserting descriptions into a playlist buffer. This lets us distinguish between the content and layout of the text, for add-ons like emms-mark that want to do something decorative with the text. darcs-hash:20070129091330-1bfb2-efe486ed3f4b256cf5817a1b36d66448a6c14196.gz
-rw-r--r--emms-playlist-mode.el16
-rw-r--r--emms.el10
2 files changed, 12 insertions, 14 deletions
diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el
index c0e789f..d3e13ee 100644
--- a/emms-playlist-mode.el
+++ b/emms-playlist-mode.el
@@ -283,7 +283,7 @@ set it as current."
(with-current-emms-playlist
(goto-char (point-max))
(when playlist-p
- (insert (emms-track-description track) "\n"))
+ (insert (emms-track-force-description track) "\n"))
(let ((beg (point)))
(if playlist-p
(emms-add-playlist name)
@@ -399,7 +399,7 @@ set it as current."
(defun emms-playlist-mode-open-buffer (filename)
"Opens a previously saved playlist buffer.
-It creates a buffer called \"filename\", and restore the contents
+It creates a buffer called \"filename\", and restores the contents
of the saved playlist inside."
(interactive "fFile: ")
(let* ((s)
@@ -411,15 +411,9 @@ of the saved playlist inside."
(with-current-buffer (emms-playlist-new name)
(emms-with-inhibit-read-only-t
(insert s)
- (condition-case nil
- (progn
- (emms-playlist-first)
- (emms-playlist-update-track)
- (while t
- (emms-playlist-next)
- (emms-playlist-update-track)))
- (error
- nil)))
+ (goto-char (point-min))
+ (emms-walk-tracks
+ (emms-playlist-update-track)))
(emms-playlist-first)
(emms-playlist-select (point))
(switch-to-buffer (current-buffer)))))
diff --git a/emms.el b/emms.el
index ae95dd1..71e4529 100644
--- a/emms.el
+++ b/emms.el
@@ -536,8 +536,12 @@ If there is no value, return DEFAULT (or nil, if not given)."
(defun emms-track-description (track)
"Return a description of TRACK.
-This function uses `emms-track-description-function'."
- (funcall emms-track-description-function track))
+This function uses the global value for `emms-track-description-function',
+rather than anything the current mode might have set.
+
+Use `emms-track-force-description' instead if you need to insert
+a description into a playlist buffer."
+ (funcall (default-value 'emms-track-description-function) track))
(defun emms-track-updated (track)
"Information in TRACK got updated."
@@ -560,7 +564,7 @@ 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)))
+ (let ((desc (funcall emms-track-description-function track)))
(if (and (stringp desc) (not (string= desc "")))
desc
(emms-track-simple-description track))))