aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-04-25 09:32:19 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-04-25 09:32:19 +0200
commit3d30ac5dc8fd2e8cb861ae2cc9165e33f83caa8a (patch)
tree63fe0f76108be681771c908bb5f0e39abf0fa44f
parent99841bbb70d2dbccc905c53a343a705b30fd1301 (diff)
simplify views--print-instance-rules
-rw-r--r--lisp/mastodon-views.el26
1 files changed, 10 insertions, 16 deletions
diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el
index de498f3..8064282 100644
--- a/lisp/mastodon-views.el
+++ b/lisp/mastodon-views.el
@@ -893,26 +893,20 @@ 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 (cond ((alist-get 'id alist)
- 'id)
- ((alist-get 'name alist)
- 'name)
- ((alist-get 'shortcode alist)
- 'shortcode)))
- (value (cond ((alist-get 'id alist)
- 'text)
- ((alist-get 'value alist)
- 'value)
- ((alist-get 'url alist)
- 'url))))
+ (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 (alist-get key alist)
- 'face '(:underline t)))
- (mastodon-views--newline-if-long (alist-get value alist))
+ (propertize key)
+ 'face '(:underline t))
+ (mastodon-views--newline-if-long value)
(format "%s" (mastodon-tl--render-text
- (alist-get value alist)))
+ value))
"\n")))
(defun mastodon-views--newline-if-long (el)