diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-11-22 16:47:21 +0100 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-11-22 16:47:49 +0100 |
commit | 77b8a2ea379e10ed8df316c116a72c476bb9af50 (patch) | |
tree | 4f0e523d08f2fce6d51b143eb7a5f8638f9195d7 /lisp/mastodon-toot.el | |
parent | 12cc327e7361065fa2b280e670496250e5163834 (diff) |
set toot language in compose buffer
like the other settings, we just save to a buffer local variable then fetch it
to send
manual testing shows that delete and redraft preserves and repeats the
setting.
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r-- | lisp/mastodon-toot.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index b3d8860..18dba06 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -171,6 +171,9 @@ change the setting on the server, see (defvar-local mastodon-toot-poll nil "A list of poll options for the toot being composed.") +(defvar-local mastodon-toot--language nil + "The language of the toot being composed, in ISO 639 (two-letter).") + (defvar-local mastodon-toot--reply-to-id nil "Buffer-local variable to hold the id of the toot being replied to.") @@ -213,6 +216,7 @@ send.") (define-key map (kbd "C-c C-a") #'mastodon-toot--attach-media) (define-key map (kbd "C-c !") #'mastodon-toot--clear-all-attachments) (define-key map (kbd "C-c C-p") #'mastodon-toot--create-poll) + (define-key map (kbd "C-c C-l") #'mastodon-toot--set-toot-lang) map) "Keymap for `mastodon-toot'.") @@ -663,7 +667,8 @@ instance to edit a toot." ("visibility" . ,mastodon-toot--visibility) ("sensitive" . ,(when mastodon-toot--content-nsfw (symbol-name t))) - ("spoiler_text" . ,spoiler))) + ("spoiler_text" . ,spoiler) + ("language" . ,mastodon-toot--language))) (args-media (when mastodon-toot--media-attachments (mastodon-http--build-array-args-alist "media_ids[]" @@ -1143,15 +1148,17 @@ LENGTH is the maximum character length allowed for a poll option." ("14 days" . ,(number-to-string (* 60 60 24 14))) ("30 days" . ,(number-to-string (* 60 60 24 30))))) -(defun mastodon-toot--prompt-toot-lang () +(defun mastodon-toot--set-toot-lang () "Prompt for a language and return its two letter ISO 639 1 code." + (interactive) (let* ((langs (mapcar (lambda (x) (cons (cadr x) (car x))) mastodon-iso-639-1)) (choice (completing-read "Language for this toot: " langs))) - (alist-get choice langs nil nil 'equal))) + (setq mastodon-toot--language + (alist-get choice langs nil nil 'equal)))) ;; we'll need to revisit this if the binds get ;; more diverse than two-chord bindings |