diff options
-rw-r--r-- | README.org | 14 | ||||
-rw-r--r-- | lisp/mastodon-profile.el | 52 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 3 |
3 files changed, 43 insertions, 26 deletions
@@ -135,7 +135,7 @@ take place if your =mastodon-token-file= does not contain =:client_id= and | =I=, =c=, =d= | view, create, and delete filters | | =R=, =a=, =r= | view/accept/reject follow requests | | =G= | view follow suggestions | -| =V= | view your favorited toots | +| =V= | view your favourited toots | | =K= | view bookmarked toots | |---------------+-----------------------------------------------------------------------| | | *Toot actions* | @@ -240,7 +240,7 @@ See =M-x customize-group RET mastodon= to view all customize options. - Timestamp format - Relative timestamps - Display user avatars - - Avatar image hight + - Avatar image height - Enable image caching - Compose options: @@ -267,7 +267,7 @@ You can translate toots with =mastodon-toot--translate-toot-text=. At the moment this requires [[https://codeberg.org/martianh/lingva.el][lingva.el]], a little interface I wrote to https://lingva.ml, to be installed to work. -You could easily modify the simple function to use your emacs translator of +You could easily modify the simple function to use your Emacs translator of choice (=libretrans.el= , =google-translate=, =babel=, =go-translate=, etc.), you just need to fetch the toot's content with =(mastodon-tl--content toot)= and pass it to your translator function as its text argument. Here's what @@ -297,6 +297,14 @@ Optional dependencies: - =mpv= and =mpv.el= for viewing videos and gifs - =lingva.el= for translating toots +** Nota Bene regarding work on this library + +I resurrected this library a few years ago, and have added stacks of features and fixes over time. But I was also only scratching my own itch, in my spare time, implementing features that I wanted to use and learning Elisp. I am not a professional programmer. I never aimed to make a full-featured client, nor do I aim to provide a professional service to anyone. I have implemented some things I don't use, such as filters, but mostly I can only fix bugs with things that I regularly rely on. My main thought was that if it was at least functioning and someone was picking some low hanging fruit, and making it look less moribund, then some more capable programmer(s) might come along and dive in also. + +Please keep this in mind when requesting features that are not implemented. Feel free to open an issue and to discuss it. But please do not feel free to order things from me as though I was a service provider, unless you are willing to consider also paying me as though I were a service provider. + +The better option is most likely going to be looking at the code a little bit and seeing how you can implement the feature yourself, especially as a lot of the functionality you're likely to need is already implemented for other features. + ** Contributing PRs, issues, feature requests, and general feedback are very welcome! diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index e664ee5..ba3a0d3 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -297,30 +297,38 @@ This is done after changing the setting on the server." (setq mastodon-profile-account-settings (plist-put mastodon-profile-account-settings pref val))) -(defun mastodon-profile-fetch-server-account-settings () +(defun mastodon-profile-fetch-server-account-settings-maybe () + "Fetch account settings from the server if `mastodon-profile-account-settings' is nil." + (mastodon-profile-fetch-server-account-settings :no-force)) + +(defun mastodon-profile-fetch-server-account-settings (&optional no-force) "Fetch basic account settings from the server. Store the values in `mastodon-profile-account-settings'. -Run in `mastodon-mode-hook'." - (let ((keys '(locked discoverable display_name bot)) - (source-keys '(privacy sensitive language))) - (mapc (lambda (k) - (mastodon-profile-update-preference-plist - k - (mastodon-profile--get-json-value k))) - keys) - (mapc (lambda (sk) - (mastodon-profile-update-preference-plist - sk - (mastodon-profile--get-source-value sk))) - source-keys) - ;; hack for max toot chars: - (mastodon-toot--get-max-toot-chars :no-toot) - (mastodon-profile-update-preference-plist 'max_toot_chars - mastodon-toot--max-toot-chars) - ;; 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)) - mastodon-profile-account-settings)) +Run in `mastodon-mode-hook'. +If NO-FORCE is non-nil, only fetch if `mastodon-profile-account-settings' is nil." + (unless + (and no-force + mastodon-profile-account-settings) + (let ((keys '(locked discoverable display_name bot)) + (source-keys '(privacy sensitive language))) + (mapc (lambda (k) + (mastodon-profile-update-preference-plist + k + (mastodon-profile--get-json-value k))) + keys) + (mapc (lambda (sk) + (mastodon-profile-update-preference-plist + sk + (mastodon-profile--get-source-value sk))) + source-keys) + ;; hack for max toot chars: + (mastodon-toot--get-max-toot-chars :no-toot) + (mastodon-profile-update-preference-plist 'max_toot_chars + mastodon-toot--max-toot-chars) + ;; 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)) + mastodon-profile-account-settings))) (defun mastodon-profile-account-locked-toggle () "Toggle the locked status of your account. diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 9a65439..f6a0f0a 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -78,6 +78,7 @@ (autoload 'mastodon-profile--update-preference "mastodon-profile") (autoload 'mastodon-profile-fetch-server-account-settings "mastodon-profile") (autoload 'mastodon-tl--render-text "mastodon-tl") +(autoload 'mastodon-profile-fetch-server-account-settings-maybe "mastodon-profile") ;; for mastodon-toot--translate-toot-text (autoload 'mastodon-tl--content "mastodon-tl") @@ -1284,7 +1285,7 @@ a draft into the buffer." (insert initial-text)))) ;;;###autoload -(add-hook 'mastodon-toot-mode-hook #'mastodon-profile-fetch-server-account-settings) +(add-hook 'mastodon-toot-mode-hook #'mastodon-profile-fetch-server-account-settings-maybe) (define-minor-mode mastodon-toot-mode "Minor mode to capture Mastodon toots." |