diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-08-04 09:39:04 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-08-04 09:39:04 +0200 |
commit | 49261b91b075b9ee77c96bbd04fa05043d29d28a (patch) | |
tree | d7aff42a185da80f7614c113125f412a9d1afc6c /lisp/mastodon-profile.el | |
parent | 46b66e332a95096773c952598c363df5e0091d53 (diff) |
Revert "replace persist with multisession"
This reverts commit f19f3bc2735bd78bb3150b8507b6f8949108cece.
Diffstat (limited to 'lisp/mastodon-profile.el')
-rw-r--r-- | lisp/mastodon-profile.el | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index cd1978f..de16b7d 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -35,6 +35,7 @@ ;;; Code: (require 'seq) (require 'cl-lib) +(require 'persist) (require 'parse-time) (require 'mastodon-http) (eval-when-compile @@ -124,8 +125,8 @@ It contains details of the current user's account.") map) "Keymap for `mastodon-profile-update-mode'.") -(define-multisession-variable mastodon-profile-account-settings nil - "An alist of account settings saved from the server. +(persist-defvar mastodon-profile-account-settings nil + "An alist of account settings saved from the server. Other clients can change these settings on the server at any time, so this list is not the canonical source for settings. It is updated on entering mastodon mode and on toggle any setting it @@ -364,16 +365,13 @@ SOURCE means that the preference is in the `source' part of the account JSON." (defun mastodon-profile--get-pref (pref) "Return PREF from `mastodon-profile-account-settings'." - (plist-get (multisession-value mastodon-profile-account-settings) - pref)) + (plist-get mastodon-profile-account-settings pref)) (defun mastodon-profile--update-preference-plist (pref val) "Set local account preference plist preference PREF to VAL. This is done after changing the setting on the server." - (setf (multisession-value mastodon-profile-account-settings) - (plist-put - (multisession-value mastodon-profile-account-settings) - pref val))) + (setq mastodon-profile-account-settings + (plist-put mastodon-profile-account-settings pref val))) ;; used in toot.el (defun mastodon-profile--fetch-server-account-settings-maybe () @@ -386,8 +384,7 @@ Only do so if `mastodon-profile-account-settings' is nil." Store the values in `mastodon-profile-account-settings'. Run in `mastodon-mode-hook'. If NO-FORCE, only fetch if `mastodon-profile-account-settings' is nil." - (unless (and no-force - (multisession-value mastodon-profile-account-settings)) + (unless (and no-force mastodon-profile-account-settings) (let ((keys '(locked discoverable display_name bot)) (source-keys '(privacy sensitive language))) (mapc (lambda (k) @@ -405,7 +402,7 @@ If NO-FORCE, only fetch if `mastodon-profile-account-settings' is nil." ;; TODO: remove now redundant vars, replace with fetchers from the plist (setq mastodon-toot--visibility (mastodon-profile--get-pref 'privacy) mastodon-toot--content-nsfw (mastodon-profile--get-pref 'sensitive)) - (multisession-value mastodon-profile-account-settings)))) + mastodon-profile-account-settings))) (defun mastodon-profile--account-locked-toggle () "Toggle the locked status of your account. |