aboutsummaryrefslogtreecommitdiff
path: root/emms-playlist-mode.el
diff options
context:
space:
mode:
authorYe Wenbin <wenbinye@gmail.com>2006-12-07 06:35:00 +0000
committerYe Wenbin <wenbinye@gmail.com>2006-12-07 06:35:00 +0000
commitea35b0637aff4d1f61dac2d25b6556a4d939e6b4 (patch)
tree6fb4ef53684159f72de480d88a2950673b199794 /emms-playlist-mode.el
parentd87cd1c3112c9e916fc71fd41721726709cae7c0 (diff)
emms-i18n changes, add playlist navigate command, uniq playlist command
darcs-hash:20061207063510-94065-7726a0fc26d04c70038d5576a0a1451e7e71e368.gz
Diffstat (limited to 'emms-playlist-mode.el')
-rw-r--r--emms-playlist-mode.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el
index 54bb739..0562fee 100644
--- a/emms-playlist-mode.el
+++ b/emms-playlist-mode.el
@@ -125,6 +125,8 @@ This is true for every invocation of `emms-playlist-mode-go'."
(define-key map (kbd "M-y") 'emms-playlist-mode-yank-pop)
(define-key map (kbd "M-<") 'emms-playlist-mode-first)
(define-key map (kbd "M->") 'emms-playlist-mode-last)
+ (define-key map (kbd "M-n") 'emms-playlist-mode-next)
+ (define-key map (kbd "M-p") 'emms-playlist-mode-previous)
(define-key map (kbd "a") 'emms-playlist-mode-add-contents)
(define-key map (kbd "b") 'emms-playlist-set-playlist-buffer)
(define-key map (kbd "d") 'emms-playlist-mode-kill-entire-track)
@@ -495,6 +497,29 @@ WINDOW-WIDTH should be a positive integer."
(emms-playlist-mode-go)
(setq emms-playlist-mode-popup-enabled t))
+(defun emms-playlist-mode-next (arg)
+ "Navigate between playlists."
+ (interactive "p")
+ (let ((playlists (remove-if-not 'buffer-live-p
+ (emms-playlist-buffer-list)))
+ bufs idx)
+ (if playlists
+ ;; if not in playlist mode, switch to emms-playlist-buffer
+ (if (not (member (current-buffer) playlists))
+ (switch-to-buffer (if (and emms-playlist-buffer
+ (buffer-live-p emms-playlist-buffer))
+ emms-playlist-buffer
+ (car playlists)))
+ (setq bufs (member (current-buffer) playlists))
+ (setq idx
+ (+ (- (length playlists) (length bufs))
+ (if (> arg 0) 1 -1)))
+ (switch-to-buffer (nth (mod idx (length playlists)) playlists)))
+ (message "No playlist found!"))))
+(defun emms-playlist-mode-previous (arg)
+ (interactive "p")
+ (emms-playlist-mode-next (- arg)))
+
(defun emms-playlist-mode-startup ()
"Instigate emms-playlist-mode on the current buffer."
;; when there is neither a current emms track or a playing one...