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

27.13 User Preferences

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

27.13.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 27.17 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.13.2 Accessing persistent settings

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

27.13.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 - 01 Dec 2021 19:30:24