aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryonirabkin <yonirabkin>2005-09-19 12:45:00 +0000
committeryonirabkin <mwolson@gnu.org>2005-09-19 12:45:00 +0000
commit705ef3e86e6cde8e728906784df405c1385c1449 (patch)
treee306858205e0d5a223ae5c6d2825f4571748f6d0
parentb16b48c14a2126d123925cb4529952bcf1c950a9 (diff)
Fix track switching error and interactive playlist yanking
darcs-hash:20050919124513-be80e-845e8aa410d52df3c7eb49a87cd08e42c2d55558.gz
-rw-r--r--emms-lyrics.el6
-rw-r--r--emms-mode-line.el4
-rw-r--r--emms-playlist-mode.el18
3 files changed, 22 insertions, 6 deletions
diff --git a/emms-lyrics.el b/emms-lyrics.el
index 63e4a1c..8ca0cdd 100644
--- a/emms-lyrics.el
+++ b/emms-lyrics.el
@@ -168,7 +168,8 @@ To find FILE, will look up in current directory and `emms-lyrics-dir'."
emms-lyrics-pause-time nil
emms-lyrics-elapsed-time 0)
(when (and emms-lyrics-display-p
- (let ((file (cdaddr (emms-playlist-selected-track))))
+ emms-lyrics-alist
+ (let ((file (cdaddr (emms-playlist-current-selected-track))))
(emms-lyrics-read-file
(replace-regexp-in-string
(file-name-extension file) "lrc" file))))
@@ -179,8 +180,7 @@ To find FILE, will look up in current directory and `emms-lyrics-dir'."
(defun emms-lyrics-stop ()
"Stop displaying lyrics."
(interactive)
- (when (and emms-lyrics-display-p
- emms-lyrics-alist)
+ (when (and emms-lyrics-alist)
(cancel-function-timers 'emms-lyrics-display)
(if (or (not emms-player-paused-p)
emms-player-stopped-p)
diff --git a/emms-mode-line.el b/emms-mode-line.el
index 33e2da0..a060274 100644
--- a/emms-mode-line.el
+++ b/emms-mode-line.el
@@ -53,7 +53,9 @@
(defun emms-mode-line-playlist-current ()
"Format the currently playing song"
- (format emms-mode-line-format (emms-track-description (emms-playlist-selected-track))))
+ (format emms-mode-line-format
+ (emms-track-description
+ (emms-playlist-current-selected-track))))
(defvar emms-mode-line-initial-titlebar frame-title-format)
diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el
index 5c81071..4115993 100644
--- a/emms-playlist-mode.el
+++ b/emms-playlist-mode.el
@@ -72,10 +72,13 @@
(define-key emms-playlist-mode-map (kbd "p") 'emms-previous)
(define-key emms-playlist-mode-map (kbd "C-x C-s") 'emms-playlist-save-buffer)
(define-key emms-playlist-mode-map (kbd "C-k") 'emms-playlist-mode-kill-track)
+ (define-key emms-playlist-mode-map (kbd "C-y")
+ #'(lambda () (interactive) (emms-playlist-mode-insert-last-killed-track kill-ring)))
(define-key emms-playlist-mode-map (kbd "d") 'emms-playlist-mode-kill-track)
(define-key emms-playlist-mode-map (kbd "s") 'emms-stop)
(define-key emms-playlist-mode-map (kbd "f") 'emms-show)
(define-key emms-playlist-mode-map (kbd "c") 'emms-playlist-mode-center-current)
+ (define-key emms-playlist-mode-map (kbd "C") 'emms-playlist-clear)
(define-key emms-playlist-mode-map (kbd "RET") 'emms-playlist-mode-play-current-track)
(define-key emms-playlist-mode-map (kbd "q") 'bury-buffer)
(define-key emms-playlist-mode-map (kbd "<mouse-2>") 'emms-playlist-mode-play-current-track)
@@ -131,6 +134,17 @@ FUN should be a function."
(emms-stop))
(emms-start))
+(defun emms-playlist-mode-insert-last-killed-track (ring)
+ (if (null ring)
+ (error "No last killed track")
+ (let ((track nil))
+ (with-temp-buffer
+ (insert (car ring))
+ (setq track (get-text-property (point-min) 'emms-track)))
+ (if track
+ (emms-playlist-insert-track track)
+ (emms-playlist-mode-insert-last-killed-track (cdr ring))))))
+
;; The logic for killing tracks in an interactive manner is
;; suprisingly annoying
(defun emms-playlist-mode-kill-track ()
@@ -139,7 +153,7 @@ FUN should be a function."
(let ((region (emms-property-region (point) 'emms-track))
(inhibit-read-only t))
(cond ((not (emms-playlist-track-at))
- (kill-line 1)) ; Purposfully kills only one line
+ (kill-line 1))
((and (not (emms-playlist-mode-selected-at))
(emms-playlist-track-at))
(kill-region (car region)
@@ -177,7 +191,7 @@ FACE should be a... face."
(defun emms-playlist-mode-overlay-unselected ()
;; point-mix/max because -insert-source narrows the world
- (emms-playlist-mode-overlay-track (point-min)
+ (emms-playlist-mode-overlay-track (point-min)
(point-max)
'emms-playlist-track-face
1))