aboutsummaryrefslogtreecommitdiff
path: root/emms.el
diff options
context:
space:
mode:
authoryonirabkin <yonirabkin>2006-01-09 08:38:00 +0000
committeryonirabkin <mwolson@gnu.org>2006-01-09 08:38:00 +0000
commit1de710aba20ad287c7e39d9b0b3804b339e6823a (patch)
tree96913e6d1744cbc101cc2868def00a2d4c0f26ec /emms.el
parentcf246d4690f5e776604f250547c96e51599c1020 (diff)
add two macros, one to emms.el and the other to emms-playlist-mode.el. The former fixes a bug in which the software attempts to access a completely narrowed buffer and the latter because it looks nicer.
darcs-hash:20060109083856-be80e-475149a8911856cab9d2dd6f5143381c53afdcae.gz
Diffstat (limited to 'emms.el')
-rw-r--r--emms.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/emms.el b/emms.el
index 5d3e656..3cbc48e 100644
--- a/emms.el
+++ b/emms.el
@@ -493,17 +493,23 @@ If no playlist exists, a new one is generated."
(interactive)
(emms-playlist-ensure-playlist-buffer)
(let ((inhibit-read-only t))
- (widen)
- (delete-region (point-min)
- (point-max)))
- (run-hooks 'emms-playlist-cleared-hook))
+ (widen)
+ (delete-region (point-min)
+ (point-max)))
+ (run-hooks 'emms-playlist-cleared-hook))
+
+(defmacro with-widened-buffer (&rest body)
+ `(save-restriction
+ (widen)
+ ,@body))
;;; Point movement within the playlist buffer.
(defun emms-playlist-track-at (&optional pos)
"Return the track at POS (point if not given), or nil if none."
(emms-playlist-ensure-playlist-buffer)
- (get-text-property (or pos (point))
- 'emms-track))
+ (with-widened-buffer
+ (get-text-property (or pos (point))
+ 'emms-track)))
(defun emms-playlist-next ()
"Move to the next track in the current buffer."
@@ -757,7 +763,7 @@ This is supplying ARGS as arguments to the source."
(emms-playlist-update-track)
(setq pos (text-property-any
(next-single-property-change (point)
- 'emms-track)
+ 'emms-track)
(point-max)
'emms-track
track))))))))