home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / guile / 1.8 / lang / elisp / internals / set.scm < prev    next >
Encoding:
Text File  |  2008-12-17  |  702 b   |  21 lines

  1. (define-module (lang elisp internals set)
  2.   #:use-module (lang elisp internals evaluation)
  3.   #:use-module (lang elisp internals signal)
  4.   #:export (set value))
  5.  
  6. ;; Set SYM's variable value to VAL, and return VAL.
  7. (define (set sym val)
  8.   (if (module-defined? the-elisp-module sym)
  9.       (module-set! the-elisp-module sym val)
  10.       (module-define! the-elisp-module sym val))
  11.   val)
  12.  
  13. ;; Return SYM's variable value.  If it has none, signal an error if
  14. ;; MUST-EXIST is true, just return #nil otherwise.
  15. (define (value sym must-exist)
  16.   (if (module-defined? the-elisp-module sym)
  17.       (module-ref the-elisp-module sym)
  18.       (if must-exist
  19.       (error "Symbol's value as variable is void:" sym)
  20.       %nil)))
  21.