[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emms-patches] darcs patch: emms-playlist-mode: Implement the option (di
From: |
Michael Olson |
Subject: |
[Emms-patches] darcs patch: emms-playlist-mode: Implement the option (disabled by ... |
Date: |
Wed, 10 May 2006 00:09:20 -0400 |
Wed May 10 00:07:30 EDT 2006 Michael Olson <address@hidden>
* emms-playlist-mode: Implement the option (disabled by default) of opening a
new EMMS buffer for a playlist, when hitting RET on one.
New patches:
[emms-playlist-mode: Implement the option (disabled by default) of opening a
new EMMS buffer for a playlist, when hitting RET on one.
Michael Olson <address@hidden>**20060510040730] {
hunk ./emms-metaplaylist-mode.el 100
-(defun get-emms-playlist-buffers ()
- "Return a list of EMMS playlist buffers."
- (let ((lis nil))
- (mapc (lambda (buf)
- (with-current-buffer buf
- (when emms-playlist-buffer-p
- (setq lis (cons buf lis)))))
- (buffer-list))
- lis))
-
hunk ./emms-metaplaylist-mode.el 106
- (playlists (get-emms-playlist-buffers)))
+ (playlists (emms-playlist-buffer-list)))
hunk ./emms-playlist-mode.el 41
+(require 'emms-source-playlist)
hunk ./emms-playlist-mode.el 70
+(defcustom emms-playlist-mode-open-playlists nil
+ "*Determine whether to open playlists in a new EMMS buffer on RET.
+This is useful if you have a master playlist buffer that is
+composed of other playlists."
+ :type 'boolean
+ :group 'emms-playlist-mode)
+
hunk ./emms-playlist-mode.el 128
+ (define-key map (kbd "k") 'emms-playlist-current-kill)
hunk ./emms-playlist-mode.el 132
- (define-key map (kbd "RET") 'emms-playlist-mode-play-current-track)
+ (define-key map (kbd "RET") 'emms-playlist-mode-play-dtrt)
hunk ./emms-playlist-mode.el 179
+(defun emms-playlist-mode-play-dtrt ()
+ "Determine the best operation to take on the current track.
+
+If on a playlist, and `emms-playlist-mode-open-playlists' is
+non-nil, load the playlist at point into a new buffer.
+
+Otherwise play the track immediately."
+ (interactive)
+ (if (not emms-playlist-mode-open-playlists)
+ (emms-playlist-mode-play-current-track)
+ (let* ((track (emms-playlist-track-at))
+ (name (emms-track-get track 'name))
+ (type (emms-track-get track 'type)))
+ (if (or (eq type 'playlist)
+ (string-match "\\.\\(m3u\\|pls\\)\\'" name))
+ (emms-playlist-mode-load-playlist)
+ (emms-playlist-mode-play-current-track)))))
+
hunk ./emms-playlist-mode.el 426
+(defun emms-playlist-mode-load-playlist ()
+ "Load the playlist into a new EMMS buffer.
+This preserves the current EMMS buffer."
+ (interactive)
+ (let* ((track (emms-playlist-track-at))
+ (name (emms-track-get track 'name))
+ (type (emms-track-get track 'type)))
+ (emms-playlist-select (point))
+ (run-hooks 'emms-player-stopped-hook)
+ (switch-to-buffer (setq emms-playlist-buffer (emms-playlist-new)))
+ (emms-add-playlist name)))
+
hunk ./emms.el 544
+
+(defun emms-playlist-buffer-list ()
+ "Return a list of EMMS playlist buffers.
+The first element will be the most recently-created playlist, and
+so on."
+ (let ((lis nil))
+ (mapc (lambda (buf)
+ (with-current-buffer buf
+ (when emms-playlist-buffer-p
+ (setq lis (cons buf lis)))))
+ (buffer-list))
+ (nreverse lis)))
+
+(defun emms-playlist-current-kill ()
+ "Kill the current EMMS playlist buffer and switch to the next one."
+ (interactive)
+ (let ((new (cadr (emms-playlist-buffer-list))))
+ (if new
+ (progn
+ (when (buffer-live-p emms-playlist-buffer)
+ (kill-buffer emms-playlist-buffer))
+ (setq emms-playlist-buffer new)
+ (switch-to-buffer emms-playlist-buffer))
+ (with-current-buffer emms-playlist-buffer
+ (bury-buffer)))))
}
Context:
[emms-playlist-mode.el: Don't put a period after the mode map. This hangs 21.4
on display.
address@hidden
[TAG 2.0
address@hidden
Patch bundle hash:
6841b8004c6e71859da0be74383750a7a19f3667
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emms-patches] darcs patch: emms-playlist-mode: Implement the option (disabled by ...,
Michael Olson <=