Gets or sets a persistent value in the user's registry.
lispworks
user-preference path value-name &key product => value, valuep
setf (user-preference path value-name &key product) value => value
path⇩ |
A string or a list of strings. |
value-name⇩ |
A string. |
product⇩ |
A keyword. |
value⇩ |
A Lisp object. |
value |
A Lisp object. |
valuep |
A boolean. |
The accessor user-preference
reads the value of the registry entry value-name under path under the registry path defined for product by (setf
product-registry-path)
. If the registry entry was found a second value t
is returned. If the registry entry was not found, then value is nil
.
The function (setf user-preference)
sets the value of that registry entry to value.
If path is a list of strings, then it is interpreted like the directory component of a pathname. If path is a string, then any directory separators should be appropriate for the platform - that is, use backslash on Windows, and forward slash on non-Windows systems.
user-preference
stores a print-escaped string in the registry and reads it back with read-from-string. Therefore it may not work with string values stored by other software.capi:top-level-interface-save-geometry-p
in the CAPI User Guide and Reference Manual.
This example is on Microsoft Windows. Note the use of backslashes as directory separators in path:
(setf (user-preference "My Stuff\\FAQ" "Ultimate Answer" :product :deep-thought) 42) => 42
This is equivalent to the previous example, and is portable because we avoid the explicit directory separators in path:
(setf (user-preference (list "My Stuff" "FAQ") "Ultimate Answer" :product :deep-thought) 42) => 42
We can retrieve values on Windows like this:
(user-preference "My Stuff\\FAQ" "Ultimate Answer" :product :deep-thought) => 42 t
We can retrieve values on any platform like this:
(user-preference (list "My Stuff" "FAQ") "Ultimate Question" :product :deep-thought) => nil nil
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:41