Location: steve@xxxxxxxxxxxxxx http://arch.eicq.org/2005/
Revision: xwem--steve--2.2--patch-12
Archive: steve@xxxxxxxxxxxxxx
Creator: Steve Youngs <steve@xxxxxxxxxxx>
Date: Mon Nov 21 16:30:23 EST 2005
Standard-date: 2005-11-21 06:30:23 GMT
Modified-files: dockapp/xwem-mpd.el
New-patches: steve@xxxxxxxxxxxxxx/xwem--steve--2.2--patch-12
Summary: xwem-mpd updates -- build fixes, drop w3m dependence.
Keywords: build/compile, enhancement, internal
This changeset cleans up the build for xwem-mpd, eliminating the
byte-compiler warnings. It also removes the dependence on w3m by
replacing it with `google-query'. This was done becaue w3m is not
distributed with XEmacs packages but google-query is.
There are other advantages to using `google-query' over w3m. With
`google-query' the user can specify which Google mirror to use, and how
many results to return. `google-query' also guards against query strings
that are too long for Google to handle.
The changeset also turns the hook variables into defcustoms and fixes a
minor typo.
* dockapp/xwem-mpd.el: Bring in `timer-funcs', `xwem-osd', `google-query',
`parse-integer' at compile time to shush up the byte-compiler.
(mpd-lyric-show): Use `google-query' instead of w3m
because `google-query' is distributed with XEmacs packages, whereas w3m
isn't. Besides, `google-query' is cooler. :-)
(xwem-mpd-lyrics-dir): Set default with `file-name-as-directory'.
(xwem-mpd-osd-setup): Typo... "STOPED" -> "STOPPED"
(mpd-after-command-hook): Turn it into a defcustom.
(mpd-before-variables-update-hook): Ditto.
(mpd-after-variables-update-hook): Ditto.
* added files
{arch}/xwem/xwem--steve/xwem--steve--2.2/steve@xxxxxxxxxxxxxx/patch-log/patch-12
* modified files
--- orig/dockapp/xwem-mpd.el
+++ mod/dockapp/xwem-mpd.el
@@ -43,6 +43,12 @@
;;; Code:
+(eval-when-compile
+ (require 'timer-funcs)
+ (autoload 'google-query "google-query" nil t)
+ (autoload 'parse-integer "parse-time")
+ (require 'xwem-osd))
+
(defgroup xwem-mpd nil
"Group to customize mpd."
:prefix "xwem-"
@@ -53,7 +59,9 @@
:type 'number
:group 'xwem-mpd)
-(defcustom xwem-mpd-lyrics-dir "~/musicpd/lyrics/"
+(defcustom xwem-mpd-lyrics-dir
+ (file-name-as-directory
+ (expand-file-name "musicpd/lyrics" (user-home-directory)))
"Directory containing songs lyrics."
:type 'directory
:group 'xwem-mpd)
@@ -73,12 +81,28 @@
(lyrics :place bottom-right :depth 0 :icon "mini-lyrics.xpm")
(volume :place right :depth 1 :font "fixed" :color "white")
(state :place center :depth 1 :font
"-*-helvetica-bold-r-*-*-20-*-*-*-*-*-*-*"
- :color "red3" :format (or (and (mpd-stopped-p) "STOPED") (and
(mpd-paused-p) "PAUSED"))))
+ :color "red3" :format (or (and (mpd-stopped-p) "STOPPED") (and
(mpd-paused-p) "PAUSED"))))
"Mpd dockapp configuration.
:place is not yet implemented."
:type 'list
:group 'xwem-mpd)
+(defcustom mpd-after-command-hook nil
+ "Hooks to run after MPD command is executed.
+Executed command name stored in `mpd-this-command'."
+ :type 'hook
+ :group 'xwem-mpd)
+
+(defcustom mpd-before-variables-update-hook nil
+ "Hooks to run before updating mpd variables."
+ :type 'hook
+ :group 'xwem-mpd)
+
+(defcustom mpd-after-variables-update-hook nil
+ "Hooks to run after mpd variables has been updated."
+ :type 'hook
+ :group 'xwem-mpd)
+
(defvar mpd-process nil)
(defvar mpd-itimer nil)
@@ -144,14 +168,6 @@
(defvar **mpd-var-volume* nil)
(defvar **mpd-var-xfade* nil)
-(defvar mpd-after-command-hook nil
- "Hooks to run after MPD command is executed.
-Executed command name stored in `mpd-this-command'.")
-(defvar mpd-before-variables-update-hook nil
- "Hooks to run before updating mpd variables.")
-(defvar mpd-after-variables-update-hook nil
- "Hooks to run after mpd variables has been updated.")
-
(defvar mpd-this-command nil
"The mpd command currently executing.
Useful to use in `mpd-after-command-hook' hooks.")
@@ -287,6 +303,9 @@
(insert text)
(save-buffer))))))
+;; This has to allow for the possibility of being called when there
+;; are no SXEmacs frames focused, so it forces a new SXEmacs frame to
+;; be created. Ugly, yes, but I couldn't think of a better way. --SY.
(define-xwem-command mpd-lyric-show ()
"Show lyrics for now playing song."
(xwem-interactive)
@@ -294,12 +313,11 @@
(let ((b (find-file-noselect (mpd-lyric-filename))))
(xwem-special-popup-frame b))
(when (and **mpd-var-Artist* **mpd-var-Title*)
- (require 'w3m)
- (browse-url
- (format "http://www.google.com/search?q=%s"
- (w3m-url-encode-string
- (format "\"%s\" \"%s\" lyrics"
- **mpd-var-Artist* **mpd-var-Title*)))))))
+ (let ((lyric-frame (new-frame)))
+ (select-frame lyric-frame)
+ (google-query (format "\"%s\" \"%s\" lyrics"
+ **mpd-var-Artist* **mpd-var-Title*))
+ (focus-frame lyric-frame)))))
;;;; Dockapp section
|