Contents

SPREFS - Preferences for a user for an application

Uses SCFG to provide preferences for a given user for a given application. This keeps a global module variable PREFERENCES. This module uses the scfg-mult-get/set! functions for accessing its configuration files.

Configuration files will be stored in $HOME/.scm_settings. Filename: $HOME/.scm_settings/<application>.scfg. Where <application> is given with sprefs-new.

Synopsis

 >(require (planet "scfg.scm" ("oesterholt" "ho-utils.plt" 1 0)))

 >(sprefs-get 'a)
 Call sprefs-new first

 >(sprefs-new "my-application")

 >(sprefs-set! '(a b c) "abc")

 >(sprefs-get '(a b c))
 "abc"
 >(sprefs-get '(a b c d))
 undef
 >(sprefs-get '(a b c d) "HI")
 "HI"

 >(sprefs-cond-set!-get '(a b c d) "HI")
 "HI"
 >(sprefs-cond-set!-get '(a b c d) "HI" "OK!")
 "OK!"
 >(sprefs-get '(a b c d) "HI")
 "OK!"

API

(sprefs-new <application>) : boolean

Initializes the global preferences configuration file. Returns #t.

(sprefs-lambda-new setter getter) : <unspecified>

Initializes the global preferences from a getter and a setter function. The getter must be of type (getter key . default-value) : value, the setter of type (setter key value) : <unspecified>.

          

(sprefs-get <key> . <default-value>) : <value>

Performs scfg-get on the given configuration file.

(sprefs-set! <key> <value>) : <unspecified>

Performs scfg-set! on the application configuration file.

(sprefs-cond-set!-get <key> <default-value> . <set-value>) : <value>

Performs scfg-cond-set!-get on the application configuration file.

Info

(c) 2005 Hans Oesterholt-Dijkema. Distributed undef LGPL. Contact: send email to hans in domain elemental-programming.org. Homepage: http://www.elemental-programming.org.