From ececf6862bde0815211e5596c7a8cf76304b11f5 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Thu, 8 Jun 2006 18:46:00 +0000 Subject: Fix compiler warnings in emms-cache.el. darcs-hash:20060608184612-1bfb2-942ae7db648d88b9dfe4896872fc3f5fdd7a30d3.gz --- emms-browser.el | 18 +++++++++++------- emms-playlist-mode.el | 6 ------ emms.el | 20 +++++++++++++++----- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/emms-browser.el b/emms-browser.el index 0aa7faa..e96c707 100644 --- a/emms-browser.el +++ b/emms-browser.el @@ -58,7 +58,9 @@ ;;; Code: +(require 'emms) (require 'emms-cache) +(require 'emms-source-file) ;; -------------------------------------------------- ;; Variables and configuration @@ -307,8 +309,9 @@ example function is `emms-browse-by-artist'." (when emms-browser-sort-function (with-current-emms-playlist (setq new-max (point-max))) - (emms-playlist-sort 'emms-sort-natural-order-less-p - old-max new-max)) + (when (fboundp 'emms-playlist-sort) + (emms-playlist-sort emms-browser-sort-function + old-max new-max))) (run-mode-hooks 'emms-browser-tracks-added-hook) (message "Added %d tracks." count))) @@ -430,11 +433,12 @@ Returns the playlist window." (setq pbuf (emms-playlist-current-clear)) (switch-to-buffer pbuf)) ;; make q in the playlist window hide the linked browser - (define-key emms-playlist-mode-map (kbd "q") - (lambda () - (interactive) - (emms-browser-hide-linked-window) - (bury-buffer))) + (when (boundp 'emms-playlist-mode-map) + (define-key emms-playlist-mode-map (kbd "q") + (lambda () + (interactive) + (emms-browser-hide-linked-window) + (bury-buffer)))) (setq pwin (get-buffer-window pbuf)) (goto-char (point-max)))) pwin)) diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el index 6e049f2..218a131 100644 --- a/emms-playlist-mode.el +++ b/emms-playlist-mode.el @@ -201,12 +201,6 @@ function switches back to the remembered buffer." (setq emms-playlist-mode-switched-buffer (current-buffer)) (switch-to-buffer emms-playlist-buffer))) -(defmacro emms-with-inhibit-read-only-t (&rest body) - "Simple wrapper around `inhibit-read-only'." - `(let ((inhibit-read-only t)) - ,@body)) -(put 'emms-with-inhibit-read-only-t 'edebug-form-spec '(body)) - (defun emms-playlist-mode-insert-newline () "Insert a newline at point." (interactive) diff --git a/emms.el b/emms.el index 795862b..7354c96 100644 --- a/emms.el +++ b/emms.el @@ -462,6 +462,21 @@ whenever possible." (setq next (cdr ptr)))) seq) + +;;; Convenient macros + +(defmacro emms-with-inhibit-read-only-t (&rest body) + "Simple wrapper around `inhibit-read-only'." + `(let ((inhibit-read-only t)) + ,@body)) +(put 'emms-with-inhibit-read-only-t 'edebug-form-spec '(body)) + +(defmacro emms-with-widened-buffer (&rest body) + `(save-restriction + (widen) + ,@body)) +(put 'emms-with-widened-buffer 'edebug-form-spec '(body)) + ;;; Tracks @@ -669,11 +684,6 @@ If no playlist exists, a new one is generated." (point-max))) (run-hooks 'emms-playlist-cleared-hook)) -(defmacro emms-with-widened-buffer (&rest body) - `(save-restriction - (widen) - ,@body)) - ;;; Point movement within the playlist buffer. (defun emms-playlist-track-at (&optional pos) "Return the track at POS (point if not given), or nil if none." -- cgit v1.2.3