All Manuals > LispWorks User Guide and Reference Manual > 27 LispWorks' Operating Environment

NextPrevUpTopContentsIndex

27.12 User Preferences

LispWorks provides an API for setting and querying persistent per-user settings in a platform-dependent registry.

27.12.1 Location of persistent settings

On Microsoft Windows the preferences are stored in the HKEY_CURRENT_USER branch of the Windows registry. (LispWorks also offers a general Windows registry API, described in Accessing the Windows registry.)

On non-Windows the preferences are stored in subdirectories of the user's home directory.

To implement preferences for your LispWorks application, you will need to define a registry path using (setf product-registry-path) and read it using product-registry-path .

27.12.2 Accessing persistent settings

Get and set preferences under the product path at run time with user-preference and (setf user-preference).

27.12.3 Example using user preferences

Define a registry path:

(setf (sys:product-registry-path :deep-thought)
      '("Software" "My Company" "Deep Thought"))

Store a preference for the current user:

(setf (user-preference "Answers" 
                       "Ultimate Question" 
                       :product :deep-thought) 
      42)

Retrieve a preference for the current user, potentially in a subsequent session:

(user-preference "Answers" "Ultimate Question"
                 :product :deep-thought)

LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex