From ea1212c32b170340cd2158545bc98bb3d74e7112 Mon Sep 17 00:00:00 2001 From: forcer Date: Wed, 14 Sep 2005 21:56:00 +0000 Subject: ogg-comment.el: Define macros before using them. darcs-hash:20050914215657-2189f-6138e4593adb14f5ae2553b3819510ae03e2cd3c.gz --- ogg-comment.el | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'ogg-comment.el') diff --git a/ogg-comment.el b/ogg-comment.el index 39a490a..f8d9f8d 100644 --- a/ogg-comment.el +++ b/ogg-comment.el @@ -74,6 +74,33 @@ (defconst oggc-version "$Revision: 1.5 $" "Ogg-comment's version number.") +(defmacro with-part-of-file (file-spec &rest body) + "Execute BODY in a buffer containing part of FILE. + +BEG and END are as `insert-file-contents' (q.v.). + +\(fn (FILE &optional BEG END) &rest BODY)" + (let (file beg end) + (setq file (pop file-spec)) + (and file-spec (setq beg (pop file-spec))) + (and file-spec (setq end (pop file-spec))) + `(with-temp-buffer + (insert-file-contents-literally ,file nil ,beg ,end) + (goto-char (point-min)) + ,@body))) + +(defmacro aif (test-form then &rest else) + "Like `if', but with `it' bound to the result of TEST-FORM. +`it' is accessible in the THEN and ELSE clauses. + +Warning, non-hygienic by design. + +\(fn TEST-FORM THEN &rest ELSE)" + `(let ((it ,test-form)) + (if it + ,then + ,@else))) + (defun oggc-split-comment (comment) "Split Ogg COMMENT into a (name, value) pair. @@ -239,33 +266,6 @@ COMMENTS should be an alist of the form: (interactive "FFile: ") (oggc-pretty-print-header (oggc-read-header file))) -(defmacro with-part-of-file (file-spec &rest body) - "Execute BODY in a buffer containing part of FILE. - -BEG and END are as `insert-file-contents' (q.v.). - -\(fn (FILE &optional BEG END) &rest BODY)" - (let (file beg end) - (setq file (pop file-spec)) - (and file-spec (setq beg (pop file-spec))) - (and file-spec (setq end (pop file-spec))) - `(with-temp-buffer - (insert-file-contents-literally ,file nil ,beg ,end) - (goto-char (point-min)) - ,@body))) - -(defmacro aif (test-form then &rest else) - "Like `if', but with `it' bound to the result of TEST-FORM. -`it' is accessible in the THEN and ELSE clauses. - -Warning, non-hygienic by design. - -\(fn TEST-FORM THEN &rest ELSE)" - `(let ((it ,test-form)) - (if it - ,then - ,@else))) - (provide 'ogg-comment) ;;; ogg-comment.el ends here -- cgit v1.2.3