From d28642c06aa145c23476514814ceb1d750ecaae7 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 9 Apr 1999 14:54:31 +0000 Subject: [PATCH] * static.el: New file. --- static.el | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 static.el diff --git a/static.el b/static.el new file mode 100644 index 0000000..8e97b71 --- /dev/null +++ b/static.el @@ -0,0 +1,65 @@ +;;; static.el --- tools for static evaluation. + +;; Copyright (C) 1999 Tanaka Akira + +;; Author: Tanaka Akira +;; Keywords: emulation, compatibility, incompatibility, Mule + +;; This file is part of APEL (A Portable Emacs Library). + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Code: + +(put 'static-if 'lisp-indent-function 2) +(defmacro static-if (cond then &rest else) + (if (eval cond) + then + (` (progn (,@ else))))) + +(put 'static-when 'lisp-indent-function 1) +(defmacro static-when (cond &rest body) + (if (eval cond) + (` (progn (,@ body))))) + +(put 'static-unless 'lisp-indent-function 1) +(defmacro static-unless (cond &rest body) + (if (eval cond) + nil + (` (progn (,@ body))))) + +(put 'static-condition-case 'lisp-indent-function 2) +(defmacro static-condition-case (var bodyform &rest handlers) + (eval (` (condition-case (, var) + (list (quote quote) (, bodyform)) + (,@ (mapcar + (if var + (lambda (h) + (` ((, (car h)) + (list (quote funcall) + (lambda ((, var)) (,@ (cdr h))) + (list (quote quote) (, var)))))) + (lambda (h) + (` ((, (car h)) (quote (progn (,@ (cdr h)))))))) + handlers)))))) + + +;;; @ end +;;; + +(provide 'static) + +;;; static.el ends here -- 1.7.10.4