Location: steve@xxxxxxxxxxxxxx http://arch.eicq.org/2005/
Revision: xwem--steve--2.2--patch-15
Archive: steve@xxxxxxxxxxxxxx
Creator: Steve Youngs <steve@xxxxxxxx>
Date: Tue Nov 22 09:00:19 EST 2005
Standard-date: 2005-11-21 23:00:19 GMT
Modified-files: dockapp/xwem-mpd.el
New-patches: steve@xxxxxxxxxxxxxx/xwem--steve--2.2--patch-15
Summary: itimer fix, nicer display of lyric files
Keywords: bugfix, enhancement, internal, ui, user-visible
This changeset fixes an itimer bug. You can't delete an itimer by name,
you have to first call `get-itimer' on it and delete the itimer object
instead. This fix also guards against `mpd-itimer' not being an itimer
or nil. A little overkill perhaps, but it's better to be safe than
sorry. :-)
This changeset also makes viewing lyric files a little friendlier. The
buffer is read-only and a couple of keys are locally bound...
`space'/`del' -- scrolling up/down
`q' -- delete frame
And it gets rid of the evilness of putting whitespace in the lyric
filenames.
* dockapp/xwem-mpd.el (mpd-lyric-filename): Whitespace in filenames is
just plain evil!
(mpd-lyric-show): A little nicer display of lyric files. Make the
buffer read-only and bind `q' to delete the frame, `space'/`del' to
scroll the buffer.
(mpd-process-sentinel): itimer fix.
* added files
{arch}/xwem/xwem--steve/xwem--steve--2.2/steve@xxxxxxxxxxxxxx/patch-log/patch-15
* modified files
--- orig/dockapp/xwem-mpd.el
+++ mod/dockapp/xwem-mpd.el
@@ -265,10 +265,12 @@
(run-hooks 'mpd-after-variables-update-hook)))
(defun mpd-process-sentinel (proc &optional evstr)
- (delete-process proc)
- (delete-itimer mpd-itimer)
- (setq mpd-itimer nil
- mpd-process nil))
+ (let ((timer (get-itimer mpd-itimer)))
+ (delete-process proc)
+ (when (itimerp timer)
+ (delete-itimer timer))
+ (setq mpd-itimer nil
+ mpd-process nil)))
(defun mpd-update-variables ()
"Requests status information."
@@ -283,7 +285,7 @@
"Return lyric filename for now playing song."
(when **mpd-var-file*
(expand-file-name
- (concat (replace-in-string **mpd-var-file* "\/" " -- ") ".txt")
+ (concat (replace-in-string **mpd-var-file* "\/" "--") ".txt")
xwem-mpd-lyrics-dir)))
(defun mpd-lyric-check ()
@@ -311,8 +313,21 @@
"Show lyrics for now playing song."
(xwem-interactive)
(if (mpd-lyric-check)
- (let ((b (find-file-noselect (mpd-lyric-filename))))
- (xwem-special-popup-frame b))
+ (let ((temp-buffer-show-function 'xwem-special-popup-frame)
+ (header (format "\"%s\" (by: %s)"
+ **mpd-var-Title*
+ **mpd-var-Artist*))
+ (title (format "Lyrics: %s" **mpd-var-Title*)))
+ (with-output-to-temp-buffer title
+ (set-buffer standard-output)
+ (insert header "\n"
+ (make-string (length header) ?=)
+ "\n\n")
+ (insert-file-contents (mpd-lyric-filename))
+ (toggle-read-only 1)
+ (local-set-key [q] 'delete-frame)
+ (local-set-key [space] 'scroll-up)
+ (local-set-key [delete] 'scroll-down)))
(when (and **mpd-var-Artist* **mpd-var-Title*)
(let ((lyric-frame (new-frame)))
(select-frame lyric-frame)
|