diff options
author | Michael Olson <mwolson@gnu.org> | 2006-04-20 23:47:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2006-04-20 23:47:00 +0000 |
commit | a33158e96b8da3e4be465baac2e918f9127a5559 (patch) | |
tree | 21c3846f3b375fab69047d474cce30055bdce905 | |
parent | 6e194a2d2a308faac79be89e26b6a49fe04e6717 (diff) |
Make XEmacs21 and Emacs21 happy.
darcs-hash:20060420234749-1bfb2-e458134b41ba8e28d25030fe5b6d6b8f4222c28d.gz
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | emms-info.el | 4 | ||||
-rw-r--r-- | emms-lyrics.el | 1 | ||||
-rw-r--r-- | emms-mode-line-icon.el | 2 | ||||
-rw-r--r-- | emms-player-mpd.el | 7 | ||||
-rw-r--r-- | emms-playing-time.el | 4 | ||||
-rw-r--r-- | emms-playlist-mode.el | 20 | ||||
-rw-r--r-- | emms-source-file.el | 3 | ||||
-rw-r--r-- | emms-stream-info.el | 14 | ||||
-rw-r--r-- | emms-streams.el | 15 | ||||
-rw-r--r-- | emms.el | 94 | ||||
-rw-r--r-- | emms.texinfo | 8 |
12 files changed, 108 insertions, 69 deletions
@@ -1,5 +1,6 @@ DESTDIR= EMACS=emacs +SITEFLAG=--no-site-file ALLSOURCE=$(wildcard *.el) SPECIAL=emms-auto.el emms-maint.el SOURCE=$(filter-out $(SPECIAL),$(ALLSOURCE)) @@ -14,14 +15,14 @@ all: $(TARGET) emms-auto.el emms.info emms-auto.el: emms-auto.in $(SOURCE) cp emms-auto.in emms-auto.el -rm -f emms-auto.elc - @$(EMACS) --no-init-file --no-site-file -batch \ + @$(EMACS) -q $(SITEFLAG) -batch \ -l emms-maint.el \ -l emms-auto.el \ -f generate-autoloads \ $(shell pwd)/emms-auto.el . %.elc: %.el - @$(EMACS) --no-init-file --no-site-file -batch \ + @$(EMACS) -q $(SITEFLAG) -batch \ -l emms-maint.el \ -f batch-byte-compile $< diff --git a/emms-info.el b/emms-info.el index d0a6be3..f259e41 100644 --- a/emms-info.el +++ b/emms-info.el @@ -83,8 +83,8 @@ Return t when the track got changed." (emms-info-track-file-mtime track)))) (when (or (not track-mtime) (when emms-info-auto-update - (time-less-p track-mtime - file-mtime))) + (emms-time-less-p track-mtime + file-mtime))) (run-hook-with-args 'emms-info-functions track) (emms-track-set track 'info-mtime file-mtime) diff --git a/emms-lyrics.el b/emms-lyrics.el index 5c07ad2..2a1ffec 100644 --- a/emms-lyrics.el +++ b/emms-lyrics.el @@ -65,6 +65,7 @@ (require 'emms) (require 'emms-player-simple) (require 'emms-source-file) +(require 'time-date) ;;; User Customization diff --git a/emms-mode-line-icon.el b/emms-mode-line-icon.el index b823bcf..bbfa321 100644 --- a/emms-mode-line-icon.el +++ b/emms-mode-line-icon.el @@ -66,7 +66,7 @@ static char *note[] = { (defun emms-mode-line-icon-function () (concat " " emms-mode-line-icon-before-format - (propertize "NP:" 'display emms-mode-line-icon-image-cache) + (emms-propertize "NP:" 'display emms-mode-line-icon-image-cache) (emms-mode-line-playlist-current))) (setq emms-mode-line-mode-line-function 'emms-mode-line-icon-function) diff --git a/emms-player-mpd.el b/emms-player-mpd.el index 956ec03..a4ebbf2 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -734,7 +734,7 @@ playlist." (setq emms-player-mpd-status-timer nil)) (let ((emms-playlist-buffer buffer)) (with-current-emms-playlist - (emms-player-mpd-play (1- (line-number-at-pos + (emms-player-mpd-play (1- (emms-line-number-at-pos emms-playlist-selected-marker)))))) (defun emms-player-mpd-start-and-sync () @@ -790,7 +790,7 @@ Afterward, the status of MusicPD will be tracked." "Stop the currently playing song. If NO-SEND is non-nil, do not send a stop command to MusicPD, just terminate the timer and mark the player as stopped." - (interactive) + (interactive "P") (emms-cancel-timer emms-player-mpd-status-timer) (setq emms-player-mpd-status-timer nil) (setq emms-player-mpd-playlist-id nil) @@ -880,8 +880,7 @@ info from MusicPD." (insertp (car closure)) (callback (cadr closure)) (buffer (cddr closure)) - (desc nil) - string) + (desc nil)) (when info (emms-track-set track 'type 'file) (emms-track-set track 'name (cdr (assoc "file" info))) diff --git a/emms-playing-time.el b/emms-playing-time.el index 3385437..f97e0ed 100644 --- a/emms-playing-time.el +++ b/emms-playing-time.el @@ -76,7 +76,7 @@ should enable `emms-playing-time-display-p' first, though." (setq emms-playing-time 0) (unless emms-playing-time-display-timer (setq emms-playing-time-display-timer - (run-at-time nil 1 'emms-playing-time-display)))) + (run-at-time t 1 'emms-playing-time-display)))) (defun emms-playing-time-stop () "Remove playing time on the mode line." @@ -94,7 +94,7 @@ should enable `emms-playing-time-display-p' first, though." (emms-playing-time-stop) (unless emms-playing-time-display-timer (setq emms-playing-time-display-timer - (run-at-time nil 1 'emms-playing-time-display))))) + (run-at-time t 1 'emms-playing-time-display))))) (defun emms-playing-time-seek (sec) "Seek forward or backward SEC playing time." diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el index 8b7ade5..b6d0b18 100644 --- a/emms-playlist-mode.el +++ b/emms-playlist-mode.el @@ -34,6 +34,10 @@ ;;; -------------------------------------------------------- (require 'emms) +(eval-when-compile + (condition-case nil + (require 'overlay) + (error nil))) (defvar emms-playlist-mode-hook nil "Emms playlist mode hook.") @@ -198,6 +202,18 @@ function switches back to the remembered buffer." ;; Emacs 21.4. The modifications make this function not equivalent to ;; the original `remove-overlays' from which it was copied, so don't ;; try to use it in the same way. + +(defun emms-copy-overlay (o) + "Return a copy of overlay O." + (if (fboundp 'copy-overlay) + (copy-overlay o) + (let ((o1 (make-overlay (overlay-start o) (overlay-end o) + (overlay-buffer o))) + (props (overlay-properties o))) + (while props + (overlay-put o1 (pop props) (pop props))) + o1))) + (defun emms-remove-all-overlays (&optional beg end) "Clear BEG and END of overlays." (unless beg (setq beg (point-min))) @@ -210,7 +226,7 @@ function switches back to the remembered buffer." (if (< (overlay-start o) beg) (if (> (overlay-end o) end) (progn - (move-overlay (copy-overlay o) + (move-overlay (emms-copy-overlay o) (overlay-start o) beg) (move-overlay o end (overlay-end o))) (move-overlay o (overlay-start o) beg)) @@ -279,7 +295,7 @@ function switches back to the remembered buffer." "Cycle through the kill-ring." (interactive) (emms-with-inhibit-read-only-t - (yank-pop))) + (yank-pop nil))) ;;; -------------------------------------------------------- ;;; Overlay diff --git a/emms-source-file.el b/emms-source-file.el index f8d5e9e..dc0c649 100644 --- a/emms-source-file.el +++ b/emms-source-file.el @@ -36,10 +36,11 @@ ;;; User Customization (require 'emms) -(eval-when-compile +(eval-when-compile (condition-case nil (require 'locate) (error nil))) +(require 'dired) (defgroup emms-source-file nil "*Sources for EMMS that use the file system." diff --git a/emms-stream-info.el b/emms-stream-info.el index 93c0de4..6238f0f 100644 --- a/emms-stream-info.el +++ b/emms-stream-info.el @@ -244,7 +244,9 @@ functions use 'emms-stream-info-return-hook'.") ;; This is our tiny state machine for keeping track across multiple ;; connections. (defvar emms-stream-info-state-bv - (make-bool-vector 3 nil) + (if (fboundp 'make-bool-vector) + (make-bool-vector 3 nil) + (make-vector 3 nil)) "State of sequential connections. true at index 0 means output formatted message. true at index 1 means insert formatted message. @@ -379,13 +381,13 @@ KEYS. KEYS should be a list of strings." (re-search-forward (concat "artist=\\(" emms-stream-info-icecast-regexp "\\)") end t) - (setq artist (match-string-no-properties 1)) + (setq artist (emms-match-string-no-properties 1)) (goto-char begin) (re-search-forward (concat "title=\\(" emms-stream-info-icecast-regexp "\\)") end t) - (setq title (match-string-no-properties 1)) + (setq title (emms-match-string-no-properties 1)) ;; ugh (if (or artist title) @@ -450,7 +452,7 @@ Argument STR Quanta of data." (progn (add-to-list 'emms-stream-info-found (cons term - (match-string-no-properties 1))) + (emms-match-string-no-properties 1))) (setq emms-stream-info-header-flag t)))) emms-stream-info-vocab)) @@ -491,8 +493,8 @@ Argument STR Quanta of data." (point-max) t) (progn (setq emms-stream-info-streamlist-found - (or (match-string-no-properties 1) - (match-string-no-properties 2))) + (or (emms-match-string-no-properties 1) + (emms-match-string-no-properties 2))) (setq emms-stream-info-streamlist-flag t)))))) ;; Be chatty at the user diff --git a/emms-streams.el b/emms-streams.el index cd35b86..a0214d7 100644 --- a/emms-streams.el +++ b/emms-streams.el @@ -157,17 +157,6 @@ needed info.") map) "Keymap for `emms-stream-menu'.") -(defun emms-stream-line-number-at-pos (&optional pos) - "Return (narrowed) buffer line number at position POS. -If POS is nil, use current buffer location." - (let ((opoint (or pos (point))) start) - (save-excursion - (goto-char (point-min)) - (setq start (point)) - (goto-char opoint) - (forward-line 0) - (1+ (count-lines start (point)))))) - ;;;###autoload (defun emms-streams () "Opens the EMMS Streams interface." @@ -319,7 +308,7 @@ Don't forget to run `emms-stream-save-bookmarks-file' after !" sURL: nFeed descriptor: SType (url or streamlist): ") - (let* ((line (emms-stream-line-number-at-pos (point))) + (let* ((line (emms-line-number-at-pos (point))) (index (+ (/ line 2) 1))) (setq emms-stream-list (emms-stream-insert-at index (list name url fd type) emms-stream-list)) @@ -331,7 +320,7 @@ SType (url or streamlist): ") Don't forget to save your modifications !" (interactive) - (let ((line (emms-stream-line-number-at-pos (point)))) + (let ((line (emms-line-number-at-pos (point)))) (setq emms-stream-list (remove (emms-stream-get-bookmark-at-point) emms-stream-list)) (emms-stream-redisplay) @@ -369,6 +369,63 @@ See `emms-repeat-track'." (error "No EMMS player playing right now"))) +;;; Compatibility functions + +(if (not (fboundp 'propertize)) + (defun emms-propertize (string &rest properties) + (set-text-properties 0 (length string) properties string) + string) + (defalias 'emms-propertize 'propertize)) + +(defun emms-cancel-timer (timer) + "Cancel the given TIMER." + (when timer + (cond ((fboundp 'cancel-timer) + (cancel-timer timer)) + ((fboundp 'delete-itimer) + (delete-itimer timer))))) + +(defun emms-time-less-p (t1 t2) + "Say whether time T1 is less than time T2." + (or (< (car t1) (car t2)) + (and (= (car t1) (car t2)) + (< (nth 1 t1) (nth 1 t2))))) + +(defun emms-replace-regexp-in-string (regexp replacement text &optional fixedcase literal) + "Replace REGEXP with REPLACEMENT in TEXT. +If fourth arg FIXEDCASE is non-nil, do not alter case of replacement text. +If fifth arg LITERAL is non-nil, insert REPLACEMENT literally." + (cond + ((fboundp 'replace-regexp-in-string) + (replace-regexp-in-string regexp replacement text fixedcase literal)) + ((fboundp 'replace-in-string) + (replace-in-string text regexp replacement literal)) + (t (let ((repl-len (length replacement)) + start) + (while (setq start (string-match regexp text start)) + (setq start (+ start repl-len) + text (replace-match replacement fixedcase literal text)))) + text))) + +(defun emms-line-number-at-pos (&optional pos) + "Return (narrowed) buffer line number at position POS. +If POS is nil, use current buffer location." + (if (fboundp 'line-number-at-pos) + (line-number-at-pos pos) + (let ((opoint (or pos (point))) start) + (save-excursion + (goto-char (point-min)) + (setq start (point)) + (goto-char opoint) + (forward-line 0) + (1+ (count-lines start (point))))))) + +(defun emms-match-string-no-properties (num &optional string) + (if (fboundp 'match-string-no-properties) + (match-string-no-properties num string) + (match-string num string))) + + ;;; Tracks ;; This is a simple datatype to store track information. @@ -763,8 +820,7 @@ This is supplying ARGS as arguments to the source." (with-current-buffer buf (when emms-playlist-buffer-p (save-excursion - (let ((beg (point-min)) - (pos (text-property-any (point-min) (point-max) + (let ((pos (text-property-any (point-min) (point-max) 'emms-track track))) (while pos (goto-char pos) @@ -1129,39 +1185,5 @@ or negative to seek backwards." (list (cons name value)))))) dict) - -;;; XEmacs compatibility - -(defun emms-cancel-timer (timer) - "Cancel the given TIMER." - (when timer - (cond ((fboundp 'cancel-timer) - (cancel-timer timer)) - ((fboundp 'delete-itimer) - (delete-itimer timer))))) - -(defun emms-replace-regexp-in-string (regexp replacement text &optional fixedcase literal) - "Replace REGEXP with REPLACEMENT in TEXT. -If fourth arg FIXEDCASE is non-nil, do not alter case of replacement text. -If fifth arg LITERAL is non-nil, insert REPLACEMENT literally." - (cond - ((fboundp 'replace-regexp-in-string) - (replace-regexp-in-string regexp replacement text fixedcase literal)) - ((fboundp 'replace-in-string) - (replace-in-string text regexp replacement literal)) - (t (let ((repl-len (length replacement)) - start) - (while (setq start (string-match regexp text start)) - (setq start (+ start repl-len) - text (replace-match replacement fixedcase literal text)))) - text))) - -(if (not (fboundp 'propertize)) - (defun emms-propertize (string &rest properties) - (set-text-properties 0 (length string) properties string) - string) - (defalias 'emms-propertize 'propertize)) - - (provide 'emms) ;;; emms.el ends here diff --git a/emms.texinfo b/emms.texinfo index ada427e..b9039da 100644 --- a/emms.texinfo +++ b/emms.texinfo @@ -165,6 +165,14 @@ then in your ~/.emacs, you should do: @cindex compiling +If you are using XEmacs, you will need to edit @file{Makefile} as +follows before continuing. + +@example +EMACS=xemacs +SITEFLAG=-no-site-file +@end example + You can byte-compile Emms by first entering the directory containing the Emms source code, followed by invoking: |