aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryonirabkin <yonirabkin>2005-09-19 13:00:00 +0000
committeryonirabkin <mwolson@gnu.org>2005-09-19 13:00:00 +0000
commit8ff0169a2e17104d9dd3e7e0b826fb8fbdedaa35 (patch)
treeddd121268d1e2445637f73c645d278b1a925b5a5
parent5a9d752d58773ad9d85ee32c4d9569f73a2cf55c (diff)
Fix bugs in lyrics and mode-line modes when switching songs, fix yanking in playlist buffer
darcs-hash:20050919130007-be80e-6b215d9ffeedd6c2a1b90412345560e9718f6d20.gz
-rw-r--r--emms-lyrics.el6
-rw-r--r--emms-mode-line.el4
-rw-r--r--emms-playlist-mode.el17
3 files changed, 21 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..d55d93a 100644
--- a/emms-playlist-mode.el
+++ b/emms-playlist-mode.el
@@ -72,6 +72,8 @@
(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)
@@ -131,6 +133,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 +152,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 +190,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))