diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-10-08 09:04:35 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-10-08 09:04:35 +0200 |
commit | 1a07051ea3ea9573df7634031203ecaf2413dbe1 (patch) | |
tree | 083f7fbcb0e7abaf7d46ed8bb0f1e7b856e38791 /lisp/mastodon-tl.el | |
parent | f965cc1f17854439b9e6ec11fb10391ae45a6942 (diff) |
add mastodon-tl--expand-content-warnings. FIX #488.
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r-- | lisp/mastodon-tl.el | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 715884b..e94d2a1 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -171,6 +171,17 @@ timeline with a simple prefix argument, `C-u'." "Whether to highlight the toot at point. Uses `cursor-face' special property." :type '(boolean)) +(defcustom mastodon-tl--expand-content-warnings 'server + "Whether to expand content warnings by default. +The API returns data about this setting on the server, but no +means to set it, so we roll our own option here to override the +server setting if desired. If you change the server setting and +want it to be respected by mastodon.el, you'll likely need to +either unset `mastodon-profile-acccount-preferences-data' and +re-load mastodon.el, or restart Emacs." + :type '(choice (const :tag "true" t) + (const :tag "false" nil) + (const :tag "follow server setting" 'server))) ;;; VARIABLES @@ -987,15 +998,20 @@ message is a link which unhides/hides the main body." cw (propertize (mastodon-tl--content toot) 'invisible - ;; check server setting to expand all spoilers: - (unless (eq t - ;; If something goes wrong reading prefs, - ;; just return nil so CWs show by default. - (condition-case nil - (mastodon-profile--get-preferences-pref - 'reading:expand:spoilers) - (error nil))) - t) + (let ((cust mastodon-tl--expand-content-warnings)) + (cond ((eq t cust) + nil) + ((eq nil cust) + t) + ((eq 'server cust) + (unless (eq t + ;; If something goes wrong reading prefs, + ;; just return nil so CWs show by default. + (condition-case nil + (mastodon-profile--get-preferences-pref + 'reading:expand:spoilers) + (error nil))) + t)))) 'mastodon-content-warning-body t)))) |