Mercurial > hg > xemacs-beta
comparison lisp/bytecomp-runtime.el @ 776:79940b592197
[xemacs-hg @ 2002-03-15 07:43:14 by ben]
.cvsignore: ignore .tmp files that are getting auto-created by VC.
Makefile.in.in: Use -no-packages to avoid problems with package files shadowing
core files (e.g. unicode.el in mule-ucs).
alloc.c, emacs.c, lisp.h: add new -no-packages. make sure list of args for sorting is
actually correct. clean up arg parsing code.
xemacs.mak: Use -no-packages to avoid problems with package files shadowing
core files (e.g. unicode.el in mule-ucs).
Makefile: Use -no-packages to avoid problems with package files shadowing
core files (e.g. unicode.el in mule-ucs).
mule\chinese.el, mule\japan-util.el: fix warnings.
behavior-defs.el: fix errors with require.
bytecomp-runtime.el: add new funs {when,and}-{f}boundp, clean up docs.
cus-edit.el: pretty-print values.
dump-paths.el, find-paths.el, startup.el, setup-paths.el: fix problems/inconsistencies parsing options. support new
-no-packages option. merge code duplication in dump-paths and
startup.
lisp-mode.el: indent macrolet and labels correctly. update comments about
lisp-indent-function. flet already handled in cl.
apropos.el, auto-save.el, buff-menu.el, cl-extra.el, dragdrop.el, faces.el, files.el, fill.el, font-lock.el, font.el, gtk-faces.el, gui.el, help.el, hyper-apropos.el, info.el, isearch-mode.el, keymap.el, lisp-mnt.el, mouse.el, package-admin.el, package-get.el, printer.el, process.el, resize-minibuffer.el, simple.el, toolbar-items.el, wid-edit.el, win32-native.el: fix warnings.
very-early-lisp.el: update docs.
mule\chinese.el, mule\japan-util.el: fix warnings.
mule\chinese.el, mule\japan-util.el: fix warnings.
behavior-defs.el: fix errors with require.
bytecomp-runtime.el: add new funs {when,and}-{f}boundp, clean up docs.
cus-edit.el: pretty-print values.
dump-paths.el, find-paths.el, startup.el, setup-paths.el: fix problems/inconsistencies parsing options. support new
-no-packages option. merge code duplication in dump-paths and
startup.
lisp-mode.el: indent macrolet and labels correctly. update comments about
lisp-indent-function. flet already handled in cl.
apropos.el, auto-save.el, buff-menu.el, cl-extra.el, dragdrop.el, faces.el, files.el, fill.el, font-lock.el, font.el, gtk-faces.el, gui.el, help.el, hyper-apropos.el, info.el, isearch-mode.el, keymap.el, lisp-mnt.el, mouse.el, package-admin.el, package-get.el, printer.el, process.el, resize-minibuffer.el, simple.el, toolbar-items.el, wid-edit.el, win32-native.el: fix warnings.
very-early-lisp.el: update docs.
mule\chinese.el, mule\japan-util.el: fix warnings.
Makefile.in.in: Use -no-packages to avoid problems with package files shadowing
core files (e.g. unicode.el in mule-ucs).
Makefile.in.in: Use -no-packages to avoid problems with package files shadowing
core files (e.g. unicode.el in mule-ucs).
author | ben |
---|---|
date | Fri, 15 Mar 2002 07:43:43 +0000 |
parents | 943eaba38521 |
children | 6728e641994e |
comparison
equal
deleted
inserted
replaced
775:7d972c3de90a | 776:79940b592197 |
---|---|
208 "Evaluate BODY, but do not issue bytecomp warnings about VARIABLES undefined. | 208 "Evaluate BODY, but do not issue bytecomp warnings about VARIABLES undefined. |
209 VARIABLES can be a symbol or a list of symbols and must be quoted. When | 209 VARIABLES can be a symbol or a list of symbols and must be quoted. When |
210 compiling this file, the warnings `reference to free variable VARIABLE' and | 210 compiling this file, the warnings `reference to free variable VARIABLE' and |
211 `assignment to free variable VARIABLE' will not occur anywhere in BODY, for | 211 `assignment to free variable VARIABLE' will not occur anywhere in BODY, for |
212 any of the listed variables. This is a clean way to avoid such warnings. | 212 any of the listed variables. This is a clean way to avoid such warnings. |
213 See also `declare-boundp', `if-boundp', `when-boundp', and | 213 |
214 `globally-declare-boundp'." | 214 See also `if-boundp', `when-boundp', and `and-boundp' (ways to |
215 conditionalize on a variable being bound and avoid warnings), | |
216 `declare-boundp' (issue a variable call without warnings), and | |
217 `globally-declare-boundp' (avoid warnings throughout a file about a | |
218 variable)." | |
215 (setq variables (eval variables)) | 219 (setq variables (eval variables)) |
216 (unless (consp variables) | 220 (unless (consp variables) |
217 (setq variables (list variables))) | 221 (setq variables (list variables))) |
218 `(progn | 222 `(progn |
219 (declare (special ,@variables)) | 223 (declare (special ,@variables)) |
223 (defmacro if-boundp (variable then &rest else) | 227 (defmacro if-boundp (variable then &rest else) |
224 "Equivalent to (if (boundp VARIABLE) THEN ELSE) but handles bytecomp warnings. | 228 "Equivalent to (if (boundp VARIABLE) THEN ELSE) but handles bytecomp warnings. |
225 VARIABLE should be a quoted symbol. When compiling this file, the warnings | 229 VARIABLE should be a quoted symbol. When compiling this file, the warnings |
226 `reference to free variable VARIABLE' and `assignment to free variable | 230 `reference to free variable VARIABLE' and `assignment to free variable |
227 VARIABLE' will not occur anywhere in the if-statement. This is a clean way | 231 VARIABLE' will not occur anywhere in the if-statement. This is a clean way |
228 to avoid such warnings. See also `when-boundp', `declare-boundp', | 232 to avoid such warnings. See also `with-boundp' and friends." |
229 `with-boundp' and `globally-declare-boundp'." | |
230 `(with-boundp ,variable | 233 `(with-boundp ,variable |
231 (if (boundp ,variable) ,then ,@else))) | 234 (if (boundp ,variable) ,then ,@else))) |
232 | 235 |
233 (put 'when-boundp 'lisp-indent-function 1) | 236 (put 'when-boundp 'lisp-indent-function 1) |
234 (defmacro when-boundp (variable &rest body) | 237 (defmacro when-boundp (variable &rest body) |
235 "Equivalent to (when (boundp VARIABLE) BODY) but handles bytecomp warnings. | 238 "Equivalent to (when (boundp VARIABLE) BODY) but handles bytecomp warnings. |
236 VARIABLE should be a quoted symbol. When compiling this file, the warnings | 239 VARIABLE should be a quoted symbol. When compiling this file, the warnings |
237 `reference to free variable VARIABLE' and `assignment to free variable | 240 `reference to free variable VARIABLE' and `assignment to free variable |
238 VARIABLE' will not occur anywhere in the when-statement. This is a clean | 241 VARIABLE' will not occur anywhere in the when-statement. This is a clean |
239 way to avoid such warnings. See also `if-boundp', `declare-boundp', | 242 way to avoid such warnings. See also `with-boundp' and friends." |
240 `with-boundp' and `globally-declare-boundp'." | |
241 `(with-boundp ,variable | 243 `(with-boundp ,variable |
242 (when (boundp ,variable) ,@body))) | 244 (when (boundp ,variable) ,@body))) |
243 | 245 |
246 (put 'and-boundp 'lisp-indent-function 1) | |
247 (defmacro and-boundp (variable &rest args) | |
248 "Equivalent to (and (boundp VARIABLE) ARGS) but handles bytecomp warnings. | |
249 VARIABLE should be a quoted symbol. When compiling this file, the warnings | |
250 `reference to free variable VARIABLE' and `assignment to free variable | |
251 VARIABLE' will not occur anywhere in the and-statement. This is a clean | |
252 way to avoid such warnings. See also `with-boundp' and friends." | |
253 `(with-boundp ,variable | |
254 (and (boundp ,variable) ,@args))) | |
255 | |
244 (defmacro declare-boundp (variable) | 256 (defmacro declare-boundp (variable) |
245 "Evaluate VARIABLE without bytecomp warnings about the symbol. | 257 "Evaluate VARIABLE without bytecomp warnings about the symbol. |
246 | 258 |
247 Sample usage is | 259 Sample usage is |
248 | 260 |
249 (declare-boundp gpm-minor-mode) | 261 (declare-boundp gpm-minor-mode) |
250 | 262 |
251 which is equivalent to | 263 which is equivalent to |
252 | 264 |
253 (with-boundp 'gpm-minor-mode | 265 (with-boundp 'gpm-minor-mode |
254 gpm-minor-mode)" | 266 gpm-minor-mode) |
267 | |
268 See also `with-boundp' and friends." | |
255 `(with-boundp ',variable ,variable)) | 269 `(with-boundp ',variable ,variable)) |
256 | 270 |
257 (defmacro globally-declare-boundp (variables) | 271 (defmacro globally-declare-boundp (variables) |
258 "Declare that all free uses of VARIABLES in this file are valid. | 272 "Declare that all free uses of VARIABLES in this file are valid. |
259 VARIABLES can be a symbol or a list of symbols and must be quoted. | 273 VARIABLES can be a symbol or a list of symbols and must be quoted. |
260 | 274 |
261 When compiling this file, the warnings `reference to free variable | 275 When compiling this file, the warnings `reference to free variable |
262 VARIABLE' and `assignment to free variable VARIABLE' will not occur | 276 VARIABLE' and `assignment to free variable VARIABLE' will not occur |
263 regardless of where references to VARIABLE occur in the file. | 277 regardless of where references to VARIABLE occur in the file. |
264 | 278 |
265 In general, you should *NOT* use this; use `declare-boundp', `if-boundp', | 279 In general, you should *NOT* use this; use `with-boundp' or its friends to |
266 `when-boundp', or `with-boundp' to wrap individual uses, as necessary. | 280 wrap individual uses, as necessary. That way, you're more likely to |
267 That way, you're more likely to remember to put in the explicit checks for | 281 remember to put in the explicit checks for the variable's existence that |
268 the variable's existence that are usually necessary. However, | 282 are usually necessary. However, `globally-declare-boundp' is better in |
269 `globally-declare-boundp' is better in some circumstances, such as when | 283 some circumstances, such as when writing an ELisp package that makes |
270 writing an ELisp package that makes integral use of optionally-compiled-in | 284 integral use of optionally-compiled-in functionality (typically, an |
271 functionality (typically, an interface onto a system library) and checks | 285 interface onto a system library) and checks for the existence of the |
272 for the existence of the functionality at some entry point to the package. | 286 functionality at some entry point to the package. See |
273 See `globally-declare-fboundp' for more information." | 287 `globally-declare-fboundp' for more information." |
274 (setq variables (eval variables)) | 288 (setq variables (eval variables)) |
275 (if (not (consp variables)) | 289 (if (not (consp variables)) |
276 (setq variables (list variables))) | 290 (setq variables (list variables))) |
277 `(progn | 291 `(progn |
278 ;; (defvar FOO) has no side effects. | 292 ;; (defvar FOO) has no side effects. |
326 (defmacro with-fboundp (functions &rest body) | 340 (defmacro with-fboundp (functions &rest body) |
327 "Evaluate BODY, but do not issue bytecomp warnings about FUNCTIONS undefined. | 341 "Evaluate BODY, but do not issue bytecomp warnings about FUNCTIONS undefined. |
328 FUNCTIONS can be a symbol or a list of symbols and must be quoted. When | 342 FUNCTIONS can be a symbol or a list of symbols and must be quoted. When |
329 compiling this file, the warning `the function FUNCTION is not known to be | 343 compiling this file, the warning `the function FUNCTION is not known to be |
330 defined' will not occur anywhere in BODY, for any of the listed functions. | 344 defined' will not occur anywhere in BODY, for any of the listed functions. |
331 This is a clean way to avoid such warnings. See also `declare-fboundp', | 345 This is a clean way to avoid such warnings. |
332 `if-fboundp', `when-fboundp', and `globally-declare-fboundp'." | 346 |
347 See also `if-fboundp', `when-fboundp', and `and-fboundp' (ways to | |
348 conditionalize on a function being bound and avoid warnings), | |
349 `declare-fboundp' (issue a function call without warnings), and | |
350 `globally-declare-fboundp' (avoid warnings throughout a file about a | |
351 function)." | |
333 `(with-fboundp-1 ,functions ,@body)) | 352 `(with-fboundp-1 ,functions ,@body)) |
334 | 353 |
335 (put 'if-fboundp 'lisp-indent-function 2) | 354 (put 'if-fboundp 'lisp-indent-function 2) |
336 (defmacro if-fboundp (function then &rest else) | 355 (defmacro if-fboundp (function then &rest else) |
337 "Equivalent to (if (fboundp FUNCTION) THEN ELSE) but handles bytecomp warnings. | 356 "Equivalent to (if (fboundp FUNCTION) THEN ELSE) but handles bytecomp warnings. |
338 FUNCTION should be a quoted symbol. When compiling this file, the warning | 357 FUNCTION should be a quoted symbol. When compiling this file, the warning |
339 `the function FUNCTION is not known to be defined' will not occur anywhere | 358 `the function FUNCTION is not known to be defined' will not occur anywhere |
340 in the if-statement. This is a clean way to avoid such warnings. See also | 359 in the if-statement. This is a clean way to avoid such warnings. See also |
341 `when-fboundp', `declare-fboundp', `with-fboundp', and | 360 `with-fboundp' and friends." |
342 `globally-declare-fboundp'." | |
343 `(with-fboundp ,function | 361 `(with-fboundp ,function |
344 (if (fboundp ,function) ,then ,@else))) | 362 (if (fboundp ,function) ,then ,@else))) |
345 | 363 |
346 (put 'when-fboundp 'lisp-indent-function 1) | 364 (put 'when-fboundp 'lisp-indent-function 1) |
347 (defmacro when-fboundp (function &rest body) | 365 (defmacro when-fboundp (function &rest body) |
348 "Equivalent to (when (fboundp FUNCTION) BODY) but handles bytecomp warnings. | 366 "Equivalent to (when (fboundp FUNCTION) BODY) but handles bytecomp warnings. |
349 FUNCTION should be a quoted symbol. When compiling this file, the warning | 367 FUNCTION should be a quoted symbol. When compiling this file, the warning |
350 `the function FUNCTION is not known to be defined' will not occur anywhere | 368 `the function FUNCTION is not known to be defined' will not occur anywhere |
351 in the when-statement. This is a clean way to avoid such warnings. See | 369 in the when-statement. This is a clean way to avoid such warnings. See also |
352 also `if-fboundp', `declare-fboundp', `with-fboundp', and | 370 `with-fboundp' and friends." |
353 `globally-declare-fboundp'." | |
354 `(with-fboundp ,function | 371 `(with-fboundp ,function |
355 (when (fboundp ,function) ,@body))) | 372 (when (fboundp ,function) ,@body))) |
373 | |
374 (put 'and-fboundp 'lisp-indent-function 1) | |
375 (defmacro and-fboundp (function &rest args) | |
376 "Equivalent to (and (fboundp FUNCTION) ARGS) but handles bytecomp warnings. | |
377 FUNCTION should be a quoted symbol. When compiling this file, the warning | |
378 `the function FUNCTION is not known to be defined' will not occur anywhere | |
379 in the and-statement. This is a clean way to avoid such warnings. See also | |
380 `with-fboundp' and friends." | |
381 `(with-fboundp ,function | |
382 (and (fboundp ,function) ,@args))) | |
356 | 383 |
357 (defmacro declare-fboundp (form) | 384 (defmacro declare-fboundp (form) |
358 "Execute FORM (a function call) without bytecomp warnings about the call. | 385 "Execute FORM (a function call) without bytecomp warnings about the call. |
359 Sample usage is | 386 Sample usage is |
360 | 387 |
361 (declare-fboundp (x-keysym-on-keyboard-sans-modifiers-p 'backspace)) | 388 (declare-fboundp (x-keysym-on-keyboard-sans-modifiers-p 'backspace)) |
362 | 389 |
363 which is equivalent to | 390 which is equivalent to |
364 | 391 |
365 (with-fboundp 'x-keysym-on-keyboard-sans-modifiers-p | 392 (with-fboundp 'x-keysym-on-keyboard-sans-modifiers-p |
366 (x-keysym-on-keyboard-sans-modifiers-p 'backspace))" | 393 (x-keysym-on-keyboard-sans-modifiers-p 'backspace)) |
394 | |
395 See also `with-fboundp' and friends." | |
367 `(with-fboundp ',(car form) ,form)) | 396 `(with-fboundp ',(car form) ,form)) |
368 | 397 |
369 (defmacro globally-declare-fboundp (functions) | 398 (defmacro globally-declare-fboundp (functions) |
370 "Declare that all calls to function FUNCTIONS in this file are valid. | 399 "Declare that all calls to function FUNCTIONS in this file are valid. |
371 FUNCTIONS can be a symbol or a list of symbols and must be quoted. | 400 FUNCTIONS can be a symbol or a list of symbols and must be quoted. |
372 | 401 |
373 When compiling this file, the warning `the function FUNCTION is not known | 402 When compiling this file, the warning `the function FUNCTION is not known |
374 to be defined' will not occur regardless of where calls to FUNCTION occur | 403 to be defined' will not occur regardless of where calls to FUNCTION occur |
375 in the file. | 404 in the file. |
376 | 405 |
377 In general, you should *NOT* use this; use `declare-fboundp', `if-fboundp', | 406 In general, you should *NOT* use this; use `with-fboundp' or its friends to |
378 `when-fboundp', or `with-fboundp' to wrap individual uses, as necessary. | 407 wrap individual uses, as necessary. That way, you're more likely to |
379 That way, you're more likely to remember to put in the explicit checks for | 408 remember to put in the explicit checks for the function's existence that |
380 the function's existence that are usually necessary. However, | 409 are usually necessary. However, `globally-declare-fboundp' is better in |
381 `globally-declare-fboundp' is better in some circumstances, such as when | 410 some circumstances, such as when writing an ELisp package that makes |
382 writing an ELisp package that makes integral use of optionally-compiled-in | 411 integral use of optionally-compiled-in functionality (typically, an |
383 functionality (typically, an interface onto a system library) and checks | 412 interface onto a system library) and checks for the existence of the |
384 for the existence of the functionality at some entry point to the package. | 413 functionality at some entry point to the package. The file `ldap.el' is a |
385 The file `ldap.el' is a good example: It provides a layer on top of the | 414 good example: It provides a layer on top of the optional LDAP ELisp |
386 optional LDAP ELisp primitives, makes calls to them throughout its code, | 415 primitives, makes calls to them throughout its code, and verifies the |
387 and verifies the presence of LDAP support at load time. Putting calls to | 416 presence of LDAP support at load time. Putting calls to `declare-fboundp' |
388 `declare-fboundp' throughout the code would be a major annoyance." | 417 throughout the code would be a major annoyance." |
389 (when (cl-compiling-file) | 418 (when (cl-compiling-file) |
390 (setq functions (eval functions)) | 419 (setq functions (eval functions)) |
391 (if (not (consp functions)) | 420 (if (not (consp functions)) |
392 (setq functions (list functions))) | 421 (setq functions (list functions))) |
393 ;; Another hack. This works because the autoload environment is | 422 ;; Another hack. This works because the autoload environment is |
427 NOTE: You should *NOT* under normal circumstances be using this! | 456 NOTE: You should *NOT* under normal circumstances be using this! |
428 There are better ways of avoiding most of these warnings. In particular: | 457 There are better ways of avoiding most of these warnings. In particular: |
429 | 458 |
430 -- use (declare (special ...)) if you are making use of | 459 -- use (declare (special ...)) if you are making use of |
431 dynamically-scoped variables. | 460 dynamically-scoped variables. |
432 -- use `if-fboundp', `when-fboundp', `declare-fboundp', `with-fboundp', or | 461 -- use `with-fboundp' and friends to avoid warnings about undefined functions |
433 `globally-declare-fboundp' to avoid warnings about undefined functions | |
434 when you know the function actually exists. | 462 when you know the function actually exists. |
435 -- use `if-boundp', `when-boundp', `declare-boundp', `with-boundp', or | 463 -- use `with-boundp' and friends to avoid warnings about undefined variables |
436 `globally-declare-boundp' to avoid warnings about undefined variables | |
437 when you know the variable actually exists. | 464 when you know the variable actually exists. |
438 -- use `with-obsolete-variable' or `with-obsolete-function' if you | 465 -- use `with-obsolete-variable' or `with-obsolete-function' if you |
439 are purposely using such a variable or function." | 466 are purposely using such a variable or function." |
440 `(with-byte-compiler-warnings-suppressed-1 ,type ,@body)) | 467 `(with-byte-compiler-warnings-suppressed-1 ,type ,@body)) |
441 | 468 |