branch: elpa/mastodon commit 3030605d6e0123aa9b4272e87a9d175777006ae3 Author: marty hiatt <martianhia...@disroot.org> Commit: marty hiatt <martianhia...@disroot.org>
star for if-/when-let calls --- lisp/mastodon-auth.el | 2 +- lisp/mastodon-media.el | 2 +- lisp/mastodon-notifications.el | 2 +- lisp/mastodon-profile.el | 38 +++++++++++++++++++------------------- lisp/mastodon-tl.el | 12 ++++++------ lisp/mastodon-toot.el | 4 ++-- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lisp/mastodon-auth.el b/lisp/mastodon-auth.el index 01639fb2bd..6e90b5348f 100644 --- a/lisp/mastodon-auth.el +++ b/lisp/mastodon-auth.el @@ -32,7 +32,7 @@ (require 'plstore) (require 'auth-source) (require 'json) -(eval-when-compile (require 'subr-x)) ; for if-let +(eval-when-compile (require 'subr-x)) ; for if-let* (autoload 'mastodon-client "mastodon-client") (autoload 'mastodon-client--active-user "mastodon-client") diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index cfb20de028..e85df1aca1 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -338,7 +338,7 @@ image-data prop so it can be toggled." "Callback function processing the `url-retrieve' response for URL. URL is a full-sized image URL attached to a timeline image. STATUS-PLIST is a plist of status events as per `url-retrieve'." - (if-let (error-response (plist-get status-plist :error)) + (if-let* (error-response (plist-get status-plist :error)) (user-error "error in loading image: %S" error-response) (when mastodon-media--enable-image-caching (unless (url-is-cached url) ;; cache if not already cached diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 5790757c00..296673cfee 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -377,7 +377,7 @@ The string returned is passed to `mastodon-notifications--insert-note'. TYPE is a symbol, a member of `mastodon-notifiations--types'. FILTERS STATUS PROFILE-NOTE FOLLOWER-NAME GROUP NOTE." (let ((body - (if-let ((match (assoc "warn" filters))) + (if-let* ((match (assoc "warn" filters))) (mastodon-tl--spoiler status (cadr match)) (mastodon-tl--clean-tabs-and-nl (cond ((mastodon-tl--has-spoiler status) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 417a787294..44a1538854 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -729,25 +729,25 @@ MAX-ID is a flag to include the max_id pagination parameter." ;; sharkey has no relationships endpoint, returns 500. ;; or poss it has a different endpoint "" - (let* ((followsp (mastodon-profile--follows-p - (list .requested_by .following .followed_by))) - (rels (mastodon-profile--relationships-get .id)) - (langs-filtered (if-let ((langs (alist-get 'languages rels))) - (concat " (" - (mapconcat #'identity langs " ") - ")") - ""))) - (if followsp - (mastodon-tl--set-face - (concat (when (eq .following t) - (format " | FOLLOWED BY YOU%s" langs-filtered)) - (when (eq .followed_by t) - " | FOLLOWS YOU") - (when (eq .requested_by t) - " | REQUESTED TO FOLLOW YOU") - "\n\n") - 'success) - ""))))) ; for insert call + (let* ((followsp (mastodon-profile--follows-p + (list .requested_by .following .followed_by))) + (rels (mastodon-profile--relationships-get .id)) + (langs-filtered (if-let* ((langs (alist-get 'languages rels))) + (concat " (" + (mapconcat #'identity langs " ") + ")") + ""))) + (if followsp + (mastodon-tl--set-face + (concat (when (eq .following t) + (format " | FOLLOWED BY YOU%s" langs-filtered)) + (when (eq .followed_by t) + " | FOLLOWS YOU") + (when (eq .requested_by t) + " | REQUESTED TO FOLLOW YOU") + "\n\n") + 'success) + ""))))) ; for insert call (mastodon-media--inline-images (point-min) (point)) ;; widget items description (mastodon-widget--create diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 781c27363b..f35dff7f11 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1014,7 +1014,7 @@ links in the text. If TOOT is nil no parsing occurs." (defun mastodon-tl--format-card-author (data) "Render card author DATA." - (when-let ((account (alist-get 'account data))) ;.account + (when-let* ((account (alist-get 'account data))) ;.account (let-alist account ;.account ;; FIXME: replace with refactored handle render fun ;; in byline refactor branch: @@ -1653,7 +1653,7 @@ in which case play first video or gif from current toot." (defun mastodon-tl--copy-image-caption () "Copy the caption of the image at point." (interactive) - (if-let ((desc (get-text-property (point) 'image-description))) + (if-let* ((desc (get-text-property (point) 'image-description))) (progn (kill-new desc) (message "Image caption copied.")) @@ -1811,7 +1811,7 @@ CW-EXPANDED means treat content warnings as unfolded." (filtered (mastodon-tl--field 'filtered toot)) (filters (when filtered (mastodon-tl--current-filters filtered))) - (spoiler-or-content (if-let ((match (assoc "warn" filters))) + (spoiler-or-content (if-let* ((match (assoc "warn" filters))) (mastodon-tl--spoiler toot (cadr match)) (if (mastodon-tl--has-spoiler toot) (mastodon-tl--spoiler toot) @@ -2414,7 +2414,7 @@ programmatically and not crash into (when unfolded-state (plist-put mastodon-tl--buffer-spec 'thread-unfolded unfolded-state)) - (when-let ((ancestors (alist-get 'ancestors context))) + (when-let* ((ancestors (alist-get 'ancestors context))) (mastodon-tl--timeline ancestors :thread)) (goto-char (point-max)) (move-marker marker (point)) @@ -2425,7 +2425,7 @@ programmatically and not crash into (when mastodon-tl--display-media-p (mastodon-media--inline-images marker ;start-pos (point))) - (when-let ((descendants (alist-get 'descendants context))) + (when-let* ((descendants (alist-get 'descendants context))) (mastodon-tl--timeline descendants :thread)) ;; put point at the toot: (goto-char (marker-position marker)) @@ -3072,7 +3072,7 @@ and profile pages when showing followers or accounts followed." (defun mastodon-tl--get-link-header-from-response (headers) "Get http Link header from list of http HEADERS." ;; pleroma uses "link", so case-insensitive match required: - (when-let ((link-headers (alist-get "Link" headers nil nil #'cl-equalp))) + (when-let* ((link-headers (alist-get "Link" headers nil nil #'cl-equalp))) (split-string link-headers ", "))) (defun mastodon-tl--more () diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index b80dc468b8..a588318c7c 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -611,7 +611,7 @@ base toot." Uses `lingva.el'." (interactive) (if mastodon-tl--buffer-spec - (if-let ((toot (mastodon-tl--property 'item-json))) + (if-let* ((toot (mastodon-tl--property 'item-json))) (condition-case x (lingva-translate nil (mastodon-tl--content toot) @@ -1979,7 +1979,7 @@ Added to `after-change-functions'." (save-match-data (let* ((fill-column 67)) (goto-char (point-min)) - (when-let ((prop (text-property-search-forward 'toot-reply))) + (when-let* ((prop (text-property-search-forward 'toot-reply))) (fill-region (prop-match-beginning prop) (point)))))))