aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-03-14 22:04:39 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-03-14 22:04:39 +0100
commit5ae092746f711942c10e9f811bb15f16551bbfba (patch)
treef0b8180eda43afec4164e619f03205cfe8ca0e07
parentb9c46ac6e5a8043ad41f14e237195a6506619aee (diff)
lsp corrections: lambdas, if to when, etc.
-rw-r--r--lisp/mastodon-profile.el4
-rw-r--r--lisp/mastodon-tl.el8
-rw-r--r--lisp/mastodon-toot.el49
3 files changed, 28 insertions, 33 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 2607b82..6af9a94 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -755,10 +755,10 @@ If toot is a boost, opens the profile of the booster."
(mastodon-profile--make-author-buffer
(alist-get 'account (mastodon-profile--toot-json))))
-(defun mastodon-profile--image-from-account (account img_type)
+(defun mastodon-profile--image-from-account (account img-type)
"Return a avatar image from ACCOUNT.
IMG_TYPE is the JSON key from the account data."
- (let ((img (alist-get img_type account)))
+ (let ((img (alist-get img-type account)))
(unless (equal img "/avatars/original/missing.png")
(mastodon-media--get-media-link-rendering img))))
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 9c12f84..c969853 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -1274,9 +1274,7 @@ this just means displaying toot client."
(alist-get 'title x))
options))
(options-number-seq (number-sequence 1 (length options)))
- (options-numbers (mapcar (lambda(x)
- (number-to-string x))
- options-number-seq))
+ (options-numbers (mapcar #'number-to-string options-number-seq))
(options-alist (cl-mapcar 'cons options-numbers options-titles))
;; we display both option number and the option title
;; but also store both as cons cell as cdr, as we need it below
@@ -2084,9 +2082,7 @@ If ID, just return that toot."
(mastodon-tl--set-face
"[n/p - prev/next\n r - reschedule\n e/RET - edit toot\n c - cancel]\n\n"
'font-lock-comment-face))
- (mapc (lambda (x)
- (mastodon-tl--insert-scheduled-toot x))
- scheduleds)
+ (mapc #'mastodon-tl--insert-scheduled-toot scheduleds)
(goto-char (point-min))
(when json
(mastodon-tl--goto-next-toot))))
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index b8930b0..bac152d 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -520,12 +520,12 @@ Uses `lingva.el'."
(msg-y-or-n (if pinned-p "Unpin" "Pin")))
(if (not pinnable-p)
(message "You can only pin your own toots.")
- (if (y-or-n-p (format "%s this toot? " msg-y-or-n))
- (mastodon-toot--action action
- (lambda ()
- (when mastodon-tl--buffer-spec
- (mastodon-tl--reload-timeline-or-profile))
- (message "Toot %s!" msg)))))))
+ (when (y-or-n-p (format "%s this toot? " msg-y-or-n))
+ (mastodon-toot--action action
+ (lambda ()
+ (when mastodon-tl--buffer-spec
+ (mastodon-tl--reload-timeline-or-profile))
+ (message "Toot %s!" msg)))))))
(defun mastodon-toot--delete-toot ()
"Delete user's toot at point synchronously."
@@ -546,22 +546,22 @@ NO-REDRAFT means delete toot only."
(reply-id (alist-get 'in_reply_to_id toot)))
(if (not (mastodon-toot--own-toot-p toot))
(message "You can only delete (and redraft) your own toots.")
- (if (y-or-n-p (if no-redraft
- (format "Delete this toot? ")
- (format "Delete and redraft this toot? ")))
- (let* ((response (mastodon-http--delete url)))
- (mastodon-http--triage
- response
- (lambda ()
- (if no-redraft
- (progn
- (when mastodon-tl--buffer-spec
- (mastodon-tl--reload-timeline-or-profile))
- (message "Toot deleted!"))
- (mastodon-toot--redraft response
- reply-id
- toot-visibility
- toot-cw)))))))))
+ (when (y-or-n-p (if no-redraft
+ (format "Delete this toot? ")
+ (format "Delete and redraft this toot? ")))
+ (let* ((response (mastodon-http--delete url)))
+ (mastodon-http--triage
+ response
+ (lambda ()
+ (if no-redraft
+ (progn
+ (when mastodon-tl--buffer-spec
+ (mastodon-tl--reload-timeline-or-profile))
+ (message "Toot deleted!"))
+ (mastodon-toot--redraft response
+ reply-id
+ toot-visibility
+ toot-cw)))))))))
(defun mastodon-toot--set-cw (&optional cw)
"Set content warning to CW if it is non-nil."
@@ -903,9 +903,8 @@ Buffer-local variable `mastodon-toot-previous-window-config' holds the config."
"Apply `mastodon-toot--process-local' function to each mention in MENTIONS.
Remove empty string (self) from result and joins the sequence with whitespace."
(mapconcat (lambda (mention) mention)
- (remove "" (mapcar (lambda (x) (mastodon-toot--process-local x))
- mentions))
- " "))
+ (remove "" (mapcar #'mastodon-toot--process-local mentions))
+ " "))
(defun mastodon-toot--process-local (acct)
"Add domain to local ACCT and replace the curent user name with \"\".