comparison lisp/bytecomp/bytecomp-runtime.el @ 155:43dd3413c7c7 r20-3b4

Import from CVS: tag r20-3b4
author cvs
date Mon, 13 Aug 2007 09:39:39 +0200
parents 538048ae2ab8
children
comparison
equal deleted inserted replaced
154:94141801dd7e 155:43dd3413c7c7
165 (defmacro eval-and-compile (&rest body) 165 (defmacro eval-and-compile (&rest body)
166 "Like `progn', but evaluates the body at compile time and at load time." 166 "Like `progn', but evaluates the body at compile time and at load time."
167 ;; Remember, it's magic. 167 ;; Remember, it's magic.
168 (cons 'progn body)) 168 (cons 'progn body))
169 169
170 ;;; From Emacs 20.
171 (put 'eval-when-feature 'lisp-indent-hook 1)
172 (defmacro eval-when-feature (feature &rest body)
173 "Run the body forms when FEATURE is featurep, be it now or later.
174 Called (eval-when-feature (FEATURE [. FILENAME]) BODYFORMS...).
175 If (featurep 'FEATURE), evals now; otherwise adds an elt to
176 `after-load-alist' (which see), using FEATURE as filename if FILENAME is nil."
177 (let ((file (or (cdr feature) (symbol-name (car feature)))))
178 `(let ((bodythunk (function (lambda () ,@body))))
179 (if (featurep ',(car feature))
180 (funcall bodythunk)
181 (setq after-load-alist (cons '(,file . (list 'lambda '() bodythunk))
182 after-load-alist))))))
183
184
170 185
171 ;;; Interface to file-local byte-compiler parameters. 186 ;;; Interface to file-local byte-compiler parameters.
172 ;;; Redefined in bytecomp.el. 187 ;;; Redefined in bytecomp.el.
173 188
174 ;;; The great RMS speaketh: 189 ;;; The great RMS speaketh: