From 2859ed4a7c7ab97cf0f56d508b8e6b328e059e9c Mon Sep 17 00:00:00 2001 From: forcer Date: Wed, 25 Oct 2006 17:51:00 +0000 Subject: emms.el: Move macros to the top of the file. darcs-hash:20061025175106-2189f-b5e2b3e02e577abf79fac5c99bb2869f7582dbb5.gz --- emms.el | 62 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/emms.el b/emms.el index 291a330..705344b 100644 --- a/emms.el +++ b/emms.el @@ -256,6 +256,38 @@ The modified track is passed as the argument to this function." This can be used if the source depends on the current buffer not being the playlist buffer.") + +;;; Macros + +;;; These need to be at the top of the file so that compilation works. + +(defmacro with-current-emms-playlist (&rest body) + "Run BODY with the current buffer being the current playlist buffer. +This also disables any read-onliness of the current buffer." + `(progn + (when (or (not emms-playlist-buffer) + (not (buffer-live-p emms-playlist-buffer))) + (emms-playlist-current-clear)) + (let ((emms-source-old-buffer (or emms-source-old-buffer + (current-buffer)))) + (with-current-buffer emms-playlist-buffer + (let ((inhibit-read-only t)) + ,@body))))) +(put 'with-current-emms-playlist 'lisp-indent-function 0) +(put 'with-current-emms-playlist 'edebug-form-spec '(body)) + +(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)) + ;;; User Interface @@ -496,21 +528,6 @@ which are part of the text that the image rests on." (forward-line (1- arg)) (forward-line 0)))) - -;;; 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 @@ -620,21 +637,6 @@ for that purpose.") (when (not emms-playlist-buffer-p) (error "Not an EMMS playlist buffer"))) -(defmacro with-current-emms-playlist (&rest body) - "Run BODY with the current buffer being the current playlist buffer. -This also disables any read-onliness of the current buffer." - `(progn - (when (or (not emms-playlist-buffer) - (not (buffer-live-p emms-playlist-buffer))) - (emms-playlist-current-clear)) - (let ((emms-source-old-buffer (or emms-source-old-buffer - (current-buffer)))) - (with-current-buffer emms-playlist-buffer - (let ((inhibit-read-only t)) - ,@body))))) -(put 'with-current-emms-playlist 'lisp-indent-function 0) -(put 'with-current-emms-playlist 'edebug-form-spec '(body)) - (defun emms-playlist-set-playlist-buffer (&optional buffer) "Set the current playlist buffer." (interactive "bNew playlist buffer: ") -- cgit v1.2.3