From 71420a495cb1647df67d124dd9a6fe45449612da Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 24 Apr 2023 23:41:47 +0200 Subject: refactor and let-alist for tl--map-rules-alist --- lisp/mastodon-tl.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index c10c9ec..5175370 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2178,13 +2178,16 @@ report the account for spam." (defvar crm-separator) +(defun mastodon-tl--map-rules-alist (rules) + (mapcar (lambda (x) + (let-alist x + `(,.text . ,.id))) + rules)) + (defun mastodon-tl--read-rules-ids () "Prompt for a list of instance rules and return a list of selected ids." (let* ((rules (mastodon-tl--instance-rules)) - (alist (mapcar (lambda (x) - (cons (alist-get 'text x) - (alist-get 'id x))) - rules)) + (alist (mastodon-tl--map-rules-alist rules)) (crm-separator (replace-regexp-in-string "," "|" crm-separator)) (choices (completing-read-multiple "rules [TAB for options, | to separate]: " -- cgit v1.2.3