diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-08 08:10:56 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-05-08 08:10:56 +0200 |
commit | 2e902e9a1458f7e4220bffb47f412a28366c8dc0 (patch) | |
tree | 25545fbdf4146e07d580fd3334fefb96f5f5d9f3 | |
parent | 347ef54b5d32cf7078e614e13ce7007aa406d54f (diff) |
let-alist -views.el
-rw-r--r-- | lisp/mastodon-views.el | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index 4f102a6..9974071 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -505,20 +505,17 @@ JSON is the data returned by the server." (defun mastodon-views--insert-scheduled-toot (toot) "Insert scheduled TOOT into the buffer." - (let* ((id (alist-get 'id toot)) - (scheduled (alist-get 'scheduled_at toot)) - (params (alist-get 'params toot)) - (text (alist-get 'text params))) + (let-alist toot (insert - (propertize (concat text + (propertize (concat .params.text " | " - (mastodon-toot--iso-to-human scheduled)) + (mastodon-toot--iso-to-human .scheduled_at)) 'byline t ; so we nav here 'toot-id "0" ; so we nav here 'face 'font-lock-comment-face 'keymap mastodon-views--scheduled-map 'scheduled-json toot - 'id id) + 'id .id) "\n"))) (defun mastodon-views--get-scheduled-toots (&optional id) @@ -889,21 +886,18 @@ IND is the optional indentation level to print at." (defun mastodon-views--print-instance-rules-or-fields (alist) "Print ALIST of instance rules or contact account or emoji fields." - (let ((key (or (alist-get 'id alist) - (alist-get 'name alist) - (alist-get 'shortcode alist))) - (value (or (alist-get 'text alist) - (alist-get 'value alist) - (alist-get 'url alist)))) - (indent-to 4) - (insert - (format "%-5s: " - (propertize key - 'face '(:underline t))) - (mastodon-views--newline-if-long value) - (format "%s" (mastodon-tl--render-text - value)) - "\n"))) + (let-alist alist + (let ((key (or .id .name .shortcode)) + (value (or .text .value .url))) + (indent-to 4) + (insert + (format "%-5s: " + (propertize key) + 'face '(:underline t)) + (mastodon-views--newline-if-long value) + (format "%s" (mastodon-tl--render-text + value)) + "\n")))) (defun mastodon-views--newline-if-long (el) "Return a newline string if the cdr of EL is over 50 characters long." |