aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-async.el22
-rw-r--r--lisp/mastodon-http.el87
-rw-r--r--lisp/mastodon-inspect.el2
-rw-r--r--lisp/mastodon-media.el4
-rw-r--r--lisp/mastodon-notifications.el68
-rw-r--r--lisp/mastodon-profile.el24
-rw-r--r--lisp/mastodon-search.el78
-rw-r--r--lisp/mastodon-tl.el54
-rw-r--r--lisp/mastodon-toot.el106
-rw-r--r--lisp/mastodon.el4
10 files changed, 224 insertions, 225 deletions
diff --git a/lisp/mastodon-async.el b/lisp/mastodon-async.el
index f7bbdff..1fabee2 100644
--- a/lisp/mastodon-async.el
+++ b/lisp/mastodon-async.el
@@ -59,10 +59,10 @@
"The intermediate queue buffer name.")
(defvar-local mastodon-async--buffer "" ;;"*mastodon-async-buffer*"
- "User facing output buffer name.")
+ "User facing output buffer name.")
(defvar-local mastodon-async--http-buffer "" ;;""
- "Buffer variable bound to http output.")
+ "Buffer variable bound to http output.")
(defun mastodon-async--display-http ()
"Display the async HTTP input buffer."
@@ -177,16 +177,16 @@ is not known when `mastodon-async--setup-buffer' is called."
NAME is used to generate the display buffer and the queue."
(let ((queue-name (concat " *mastodon-async-queue-" name "-"
- mastodon-instance-url "*"))
+ mastodon-instance-url "*"))
(buffer-name (concat "*mastodon-async-display-" name "-"
- mastodon-instance-url "*")))
+ mastodon-instance-url "*")))
(mastodon-async--set-local-variables http-buffer http-buffer
buffer-name queue-name)))
(defun mastodon-async--setup-queue (http-buffer name)
"Sets up the buffer for the async queue."
(let ((queue-name (concat " *mastodon-async-queue-" name "-"
- mastodon-instance-url "*"))
+ mastodon-instance-url "*"))
(buffer-name(concat "*mastodon-async-display-" name "-"
mastodon-instance-url "*")))
(mastodon-async--set-local-variables queue-name http-buffer
@@ -203,8 +203,8 @@ ENPOINT is the endpoint for the stream and timeline."
mastodon-instance-url "*"))
(buffer-name (concat "*mastodon-async-display-" name "-"
mastodon-instance-url "*"))
- ;; if user stream, we need "timelines/home" not "timelines/user"
- ;; if notifs, we need "notifications" not "timelines/notifications"
+ ;; if user stream, we need "timelines/home" not "timelines/user"
+ ;; if notifs, we need "notifications" not "timelines/notifications"
(endpoint (if (equal name "notifications") "notifications"
(if (equal name "home") "timelines/home"
(format "timelines/%s" endpoint)))))
@@ -285,8 +285,8 @@ Filter the toots using FILTER."
;; NB notification events in streams include follow requests
(let* ((split-strings (split-string string "\n" t))
(event-type (replace-regexp-in-string
- "^event: " ""
- (car split-strings)))
+ "^event: " ""
+ (car split-strings)))
(data (replace-regexp-in-string
"^data: " "" (cadr split-strings))))
(when (equal "notification" event-type)
@@ -304,8 +304,8 @@ Filter the toots using FILTER."
(defun mastodon-async--account-local-p (json)
"Test JSON to see if account is local."
(not (string-match-p
- "@"
- (cdr (assoc 'acct (cdr (assoc 'account json)))))))
+ "@"
+ (cdr (assoc 'acct (cdr (assoc 'account json)))))))
(defun mastodon-async--output-toot (toot)
"Process TOOT and prepend it to the async user-facing buffer."
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 875e9bf..a183ed7 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -153,8 +153,8 @@ is available we will call it with or without a timeout."
(buffer-substring-no-properties (point) (point-max))
'utf-8)))
(kill-buffer)
- (unless (or (string-equal "" json-string) (null json-string)))
- (json-read-from-string json-string)))
+ (unless (or (string-equal "" json-string) (null json-string))
+ (json-read-from-string json-string))))
(defun mastodon-http--delete (url)
"Make DELETE request to URL."
@@ -256,8 +256,8 @@ Authorization header is included by default unless UNAUTHENTICED-P is non-nil."
args
"&")))
(url-request-extra-headers
- (append `(("Authorization" . ,(concat "Bearer " (mastodon-auth--access-token))))
- headers)))
+ (append `(("Authorization" . ,(concat "Bearer " (mastodon-auth--access-token))))
+ headers)))
(with-temp-buffer
(url-retrieve url callback cbargs))))
@@ -269,46 +269,45 @@ The upload is asynchronous. On succeeding,
item uploaded, and `mastodon-toot--update-status-fields' is run."
(let* ((file (file-name-nondirectory filename))
(request-backend 'curl))
- ;; (response
- (request
- url
- :type "POST"
- :params `(("description" . ,caption))
- :files `(("file" . (,file :file ,filename
- :mime-type "multipart/form-data")))
- :parser 'json-read
- :headers `(("Authorization" . ,(concat "Bearer "
- (mastodon-auth--access-token))))
- :sync t
- :success (cl-function
- (lambda (&key data &allow-other-keys)
- (when data
- (progn
- (push (cdr (assoc 'id data))
- mastodon-toot--media-attachment-ids) ; add ID to list
- (message "%s file %s with id %S and caption '%s' uploaded!"
- (capitalize (cdr (assoc 'type data)))
- file
- (cdr (assoc 'id data))
- (cdr (assoc 'description data)))
- (mastodon-toot--update-status-fields)))))
- :error (cl-function
- (lambda (&key error-thrown &allow-other-keys)
- (cond
- ;; handle curl errors first (eg 26, can't read file/path)
- ;; because the '=' test below fails for them
- ;; they have the form (error . error message 24)
- ((not (proper-list-p error-thrown)) ; not dotted list
- (message "Got error: %s. Shit went south." (cdr error-thrown)))
- ;; handle mastodon api errors
- ;; they have the form (error http 401)
- ((= (car (last error-thrown)) 401)
- (message "Got error: %s Unauthorized: The access token is invalid" error-thrown))
- ((= (car (last error-thrown)) 422)
- (message "Got error: %s Unprocessable entity: file or file type is unsupported or invalid" error-thrown))
- (t
- (message "Got error: %s Shit went south"
- error-thrown))))))))
+ (request
+ url
+ :type "POST"
+ :params `(("description" . ,caption))
+ :files `(("file" . (,file :file ,filename
+ :mime-type "multipart/form-data")))
+ :parser 'json-read
+ :headers `(("Authorization" . ,(concat "Bearer "
+ (mastodon-auth--access-token))))
+ :sync t
+ :success (cl-function
+ (lambda (&key data &allow-other-keys)
+ (when data
+ (progn
+ (push (cdr (assoc 'id data))
+ mastodon-toot--media-attachment-ids) ; add ID to list
+ (message "%s file %s with id %S and caption '%s' uploaded!"
+ (capitalize (cdr (assoc 'type data)))
+ file
+ (cdr (assoc 'id data))
+ (cdr (assoc 'description data)))
+ (mastodon-toot--update-status-fields)))))
+ :error (cl-function
+ (lambda (&key error-thrown &allow-other-keys)
+ (cond
+ ;; handle curl errors first (eg 26, can't read file/path)
+ ;; because the '=' test below fails for them
+ ;; they have the form (error . error message 24)
+ ((not (proper-list-p error-thrown)) ; not dotted list
+ (message "Got error: %s. Shit went south." (cdr error-thrown)))
+ ;; handle mastodon api errors
+ ;; they have the form (error http 401)
+ ((= (car (last error-thrown)) 401)
+ (message "Got error: %s Unauthorized: The access token is invalid" error-thrown))
+ ((= (car (last error-thrown)) 422)
+ (message "Got error: %s Unprocessable entity: file or file type is unsupported or invalid" error-thrown))
+ (t
+ (message "Got error: %s Shit went south"
+ error-thrown))))))))
(provide 'mastodon-http)
;;; mastodon-http.el ends here
diff --git a/lisp/mastodon-inspect.el b/lisp/mastodon-inspect.el
index 2181ea2..4647335 100644
--- a/lisp/mastodon-inspect.el
+++ b/lisp/mastodon-inspect.el
@@ -59,7 +59,7 @@
(concat "*mastodon-inspect-toot-"
(mastodon-tl--as-string (mastodon-tl--property 'toot-id))
"*")
- (mastodon-tl--property 'toot-json)))
+ (mastodon-tl--property 'toot-json)))
(defun mastodon-inspect--download-single-toot (toot-id)
"Download the toot/status represented by TOOT-ID."
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el
index 5f8f46c..f7386c6 100644
--- a/lisp/mastodon-media.el
+++ b/lisp/mastodon-media.el
@@ -161,7 +161,7 @@ with the image."
t image-options))))
(when mastodon-media--enable-image-caching
(unless (url-is-cached url) ; cache if not already cached
- (url-store-in-cache url-buffer)))
+ (url-store-in-cache url-buffer)))
(with-current-buffer (marker-buffer marker)
;; Save narrowing in our buffer
(let ((inhibit-read-only t))
@@ -239,7 +239,7 @@ found."
;; Avatars are just one character in the buffer
((eq media-type 'avatar)
(list next-pos (+ next-pos 1) 'avatar))
- ;; Media links are 5 character ("[img]")
+ ;; Media links are 5 character ("[img]")
((eq media-type 'media-link)
(list next-pos (+ next-pos 5) 'media-link)))))))
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index 36f9d4a..2430bcc 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -80,23 +80,23 @@
(let* ((toot-json (mastodon-tl--property 'toot-json))
(f-req-p (string= "follow_request" (cdr (assoc 'type toot-json)))))
(if f-req-p
- (let* ((account (cdr (assoc 'account toot-json)))
- (id (cdr (assoc 'id account)))
- (handle (cdr (assoc 'acct account)))
- (name (cdr (assoc 'username account))))
- (if id
- (let ((response
- (mastodon-http--post
- (concat
- (mastodon-http--api "follow_requests")
- (format "/%s/authorize" id))
- nil nil)))
- (mastodon-http--triage response
- (lambda ()
- (mastodon-notifications--get)
- (message "Follow request of %s (@%s) accepted!"
- name handle))))
- (message "No account result at point?")))
+ (let* ((account (cdr (assoc 'account toot-json)))
+ (id (cdr (assoc 'id account)))
+ (handle (cdr (assoc 'acct account)))
+ (name (cdr (assoc 'username account))))
+ (if id
+ (let ((response
+ (mastodon-http--post
+ (concat
+ (mastodon-http--api "follow_requests")
+ (format "/%s/authorize" id))
+ nil nil)))
+ (mastodon-http--triage response
+ (lambda ()
+ (mastodon-notifications--get)
+ (message "Follow request of %s (@%s) accepted!"
+ name handle))))
+ (message "No account result at point?")))
(message "No follow request at point?")))))
(defun mastodon-notifications--follow-request-reject-notifs ()
@@ -106,23 +106,23 @@
(let* ((toot-json (mastodon-tl--property 'toot-json))
(f-req-p (string= "follow_request" (cdr (assoc 'type toot-json)))))
(if f-req-p
- (let* ((account (cdr (assoc 'account toot-json)))
- (id (cdr (assoc 'id account)))
- (handle (cdr (assoc 'acct account)))
- (name (cdr (assoc 'username account))))
- (if id
- (let ((response
- (mastodon-http--post
- (concat
- (mastodon-http--api "follow_requests")
- (format "/%s/reject" id))
- nil nil)))
- (mastodon-http--triage response
- (lambda ()
- (mastodon-notifications--get)
- (message "Follow request of %s (@%s) rejected!"
- name handle))))
- (message "No account result at point?")))
+ (let* ((account (cdr (assoc 'account toot-json)))
+ (id (cdr (assoc 'id account)))
+ (handle (cdr (assoc 'acct account)))
+ (name (cdr (assoc 'username account))))
+ (if id
+ (let ((response
+ (mastodon-http--post
+ (concat
+ (mastodon-http--api "follow_requests")
+ (format "/%s/reject" id))
+ nil nil)))
+ (mastodon-http--triage response
+ (lambda ()
+ (mastodon-notifications--get)
+ (message "Follow request of %s (@%s) rejected!"
+ name handle))))
+ (message "No account result at point?")))
(message "No follow request at point?")))))
(defun mastodon-notifications--mention (note)
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 31499ed..b68be6f 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -256,20 +256,20 @@ Returns a list of lists."
(let* ((car-fields (mapcar 'car fields))
;; (cdr-fields (mapcar 'cadr fields))
;; (cdr-fields-rendered
- ;; (list
- ;; (mapcar (lambda (x)
- ;; (mastodon-tl--render-text x nil))
- ;; cdr-fields)))
+ ;; (list
+ ;; (mapcar (lambda (x)
+ ;; (mastodon-tl--render-text x nil))
+ ;; cdr-fields)))
(left-width (car (sort (mapcar 'length car-fields) '>))))
- ;; (right-width (car (sort (mapcar 'length cdr-fields) '>))))
+ ;; (right-width (car (sort (mapcar 'length cdr-fields) '>))))
(mapconcat (lambda (field)
(mastodon-tl--render-text
(concat
(format "_ %s " (car field))
(make-string (- (+ 1 left-width) (length (car field))) ?_)
(format " :: %s" (cadr field)))
- ;; (make-string (- (+ 1 right-width) (length (cdr field))) ?_)
- ;; " |")
+ ;; (make-string (- (+ 1 right-width) (length (cdr field))) ?_)
+ ;; " |")
field)) ; nil)) ; hack to make links tabstops
fields "")))
@@ -307,7 +307,7 @@ Returns a list of lists."
account 'statuses_count)))
(relationships (mastodon-profile--relationships-get id))
(followed-by-you (cdr (assoc 'following
- (aref relationships 0))))
+ (aref relationships 0))))
(follows-you (cdr (assoc 'followed_by
(aref relationships 0))))
(followsp (or (equal follows-you 't) (equal followed-by-you 't)))
@@ -327,9 +327,9 @@ Returns a list of lists."
(is-followers (string= endpoint-type "followers"))
(is-following (string= endpoint-type "following"))
(endpoint-name (cond
- (is-statuses " TOOTS ")
- (is-followers " FOLLOWERS ")
- (is-following " FOLLOWING "))))
+ (is-statuses " TOOTS ")
+ (is-followers " FOLLOWERS ")
+ (is-following " FOLLOWING "))))
(insert
"\n"
(mastodon-profile--image-from-account account)
@@ -382,7 +382,7 @@ Returns a list of lists."
'success))
(setq mastodon-tl--update-point (point))
(mastodon-media--inline-images (point-min) (point))
- ;; insert pinned toots first
+ ;; insert pinned toots first
(when (and pinned (equal endpoint-type "statuses"))
(mastodon-profile--insert-statuses-pinned pinned)
(setq mastodon-tl--update-point (point))) ;updates to follow pinned toots
diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el
index 5f52bb7..cbb452d 100644
--- a/lisp/mastodon-search.el
+++ b/lisp/mastodon-search.el
@@ -80,7 +80,7 @@ Returns a nested list containing user handle, display name, and URL."
(tags-list (mapcar #'mastodon-search--get-hashtag-info
tags))
;; (status-list (mapcar #'mastodon-search--get-status-info
- ;; statuses))
+ ;; statuses))
(status-ids-list (mapcar 'mastodon-search--get-id-from-status
statuses))
(toots-list-json (mapcar #'mastodon-search--fetch-full-status-from-id
@@ -97,42 +97,42 @@ Returns a nested list containing user handle, display name, and URL."
" ------------\n\n")
'success))
(mapc (lambda (el)
- (insert (propertize (car el) 'face 'mastodon-display-name-face)
- " : \n : "
- (propertize (concat "@" (car (cdr el)))
- 'face 'mastodon-handle-face
- 'mouse-face 'highlight
- 'mastodon-tab-stop 'user-handle
- 'keymap mastodon-tl--link-keymap
- 'mastodon-handle (concat "@" (car (cdr el)))
- 'help-echo (concat "Browse user profile of @" (car (cdr el))))
- " : \n"
- "\n"))
- user-ids)
- ;; hashtag results:
- (insert (mastodon-tl--set-face
- (concat "\n ------------\n"
- " HASHTAGS\n"
- " ------------\n\n")
- 'success))
- (mapc (lambda (el)
- (insert " : #"
- (propertize (car el)
- 'mouse-face 'highlight
- 'mastodon-tag (car el)
- 'mastodon-tab-stop 'hashtag
- 'help-echo (concat "Browse tag #" (car el))
- 'keymap mastodon-tl--link-keymap)
- " : \n\n"))
- tags-list)
- ;; status results:
- (insert (mastodon-tl--set-face
- (concat "\n ------------\n"
- " STATUSES\n"
- " ------------\n")
- 'success))
- (mapc 'mastodon-tl--toot toots-list-json)
- (goto-char (point-min))))))
+ (insert (propertize (car el) 'face 'mastodon-display-name-face)
+ " : \n : "
+ (propertize (concat "@" (car (cdr el)))
+ 'face 'mastodon-handle-face
+ 'mouse-face 'highlight
+ 'mastodon-tab-stop 'user-handle
+ 'keymap mastodon-tl--link-keymap
+ 'mastodon-handle (concat "@" (car (cdr el)))
+ 'help-echo (concat "Browse user profile of @" (car (cdr el))))
+ " : \n"
+ "\n"))
+ user-ids)
+ ;; hashtag results:
+ (insert (mastodon-tl--set-face
+ (concat "\n ------------\n"
+ " HASHTAGS\n"
+ " ------------\n\n")
+ 'success))
+ (mapc (lambda (el)
+ (insert " : #"
+ (propertize (car el)
+ 'mouse-face 'highlight
+ 'mastodon-tag (car el)
+ 'mastodon-tab-stop 'hashtag
+ 'help-echo (concat "Browse tag #" (car el))
+ 'keymap mastodon-tl--link-keymap)
+ " : \n\n"))
+ tags-list)
+ ;; status results:
+ (insert (mastodon-tl--set-face
+ (concat "\n ------------\n"
+ " STATUSES\n"
+ " ------------\n")
+ 'success))
+ (mapc 'mastodon-tl--toot toots-list-json)
+ (goto-char (point-min))))))
(defun mastodon-search--get-user-info (account)
"Get user handle, display name and account URL from ACCOUNT."
@@ -153,7 +153,7 @@ Returns a nested list containing user handle, display name, and URL."
(cdr (assoc 'content status))))
(defun mastodon-search--get-id-from-status (status)
- "Fetch the id from a STATUS returned by a search call to the server.
+ "Fetch the id from a STATUS returned by a search call to the server.
We use this to fetch the complete status from the server."
(cdr (assoc 'id status)))
@@ -164,7 +164,7 @@ We use this to fetch the complete status from the server."
This allows us to access the full account etc. details and to
render them properly."
(let* ((url (concat mastodon-instance-url "/api/v1/statuses/" (mastodon-tl--as-string id)))
- (json (mastodon-http--get-json url)))
+ (json (mastodon-http--get-json url)))
json))
(provide 'mastodon-search)
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index e4c179c..d300a09 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -91,10 +91,10 @@ width fonts when rendering HTML text"))
:type '(boolean :tag "Whether to display user avatars in timelines"))
;; (defvar mastodon-tl--show-avatars nil
- ;; (if (version< emacs-version "27.1")
- ;; (image-type-available-p 'imagemagick)
- ;; (image-transforms-p))
- ;; "A boolean value stating whether to show avatars in timelines.")
+;; (if (version< emacs-version "27.1")
+;; (image-type-available-p 'imagemagick)
+;; (image-transforms-p))
+;; "A boolean value stating whether to show avatars in timelines.")
(defvar-local mastodon-tl--update-point nil
"When updating a mastodon buffer this is where new toots will be inserted.
@@ -463,7 +463,7 @@ START and END are the boundaries of the link in the toot."
(url-instance (concat "https://"
(url-host (url-generic-parse-url url))))
(maybe-userhandle (if (string= mastodon-instance-url url-instance)
- ; if handle is local, then no instance suffix:
+ ; if handle is local, then no instance suffix:
(buffer-substring-no-properties start end)
(mastodon-tl--extract-userhandle-from-url
url (buffer-substring-no-properties start end)))))
@@ -652,12 +652,12 @@ message is a link which unhides/hides the main body."
(mastodon-tl--render-text spoiler toot))
'default))
(message (concat ;"\n"
- " ---------------\n"
- " " (mastodon-tl--make-link
- (concat "CW: " string)
- 'content-warning)
- "\n"
- " ---------------\n"))
+ " ---------------\n"
+ " " (mastodon-tl--make-link
+ (concat "CW: " string)
+ 'content-warning)
+ "\n"
+ " ---------------\n"))
(cw (mastodon-tl--set-face message 'mastodon-cw-face)))
(concat
cw
@@ -747,10 +747,10 @@ takes a single function. By default it is
(concat "Poll: \n\n"
(mapconcat (lambda (option)
(progn
- (format "Option %s: %s, %s votes.\n"
- (setq option-counter (1+ option-counter))
- (cdr (assoc 'title option))
- (cdr (assoc 'votes_count option)))))
+ (format "Option %s: %s, %s votes.\n"
+ (setq option-counter (1+ option-counter))
+ (cdr (assoc 'title option))
+ (cdr (assoc 'votes_count option)))))
options
"\n") "\n")))
@@ -764,8 +764,8 @@ takes a single function. By default it is
(mastodon-tl--field 'poll toot)))
(options (mastodon-tl--field 'options poll))
(options-titles (mapcar (lambda (x)
- (cdr (assoc 'title x)))
- options))
+ (cdr (assoc 'title x)))
+ options))
(options-number-seq (number-sequence 1 (length options)))
(options-numbers (mapcar (lambda(x)
(number-to-string x))
@@ -775,16 +775,16 @@ takes a single function. By default it is
;; but also store both as cons cell as cdr, as we need it below
(candidates (mapcar (lambda (cell)
(cons (format "%s | %s" (car cell) (cdr cell))
- cell))
+ cell))
options-alist)))
(if (null (mastodon-tl--field 'poll (mastodon-tl--property 'toot-json)))
(message "No poll here.")
;; var "option" = just the cdr, a cons of option number and desc
(cdr (assoc
(completing-read "Poll option to vote for: "
- candidates
- nil ; (predicate)
- t) ; require match
+ candidates
+ nil ; (predicate)
+ t) ; require match
candidates))))))
(if (null (mastodon-tl--field 'poll (mastodon-tl--property 'toot-json)))
(message "No poll here.")
@@ -961,7 +961,7 @@ webapp"
nil ; predicate
'confirm))))
(let* ((account (mastodon-profile--lookup-account-in-status
- user-handle (mastodon-profile--toot-json)))
+ user-handle (mastodon-profile--toot-json)))
(user-id (mastodon-profile--account-field account 'id))
(name (mastodon-profile--account-field account 'display_name))
(url (mastodon-http--api (format "accounts/%s/follow" user-id))))
@@ -983,7 +983,7 @@ webapp"
nil ; predicate
'confirm))))
(let* ((account (mastodon-profile--lookup-account-in-status
- user-handle (mastodon-profile--toot-json)))
+ user-handle (mastodon-profile--toot-json)))
(user-id (mastodon-profile--account-field account 'id))
(name (mastodon-profile--account-field account 'display_name))
(url (mastodon-http--api (format "accounts/%s/unfollow" user-id))))
@@ -1006,7 +1006,7 @@ webapp"
nil ; predicate
'confirm))))
(let* ((account (mastodon-profile--lookup-account-in-status
- user-handle (mastodon-profile--toot-json)))
+ user-handle (mastodon-profile--toot-json)))
(user-id (mastodon-profile--account-field account 'id))
(name (mastodon-profile--account-field account 'display_name))
(url (mastodon-http--api (format "accounts/%s/mute" user-id))))
@@ -1026,7 +1026,7 @@ webapp"
(mutes-json (mastodon-http--get-json mutes-url))
(muted-accts (mapcar (lambda (muted)
(cdr (assoc 'acct muted)))
- mutes-json)))
+ mutes-json)))
(completing-read "Handle of user to unmute: "
muted-accts
nil ; predicate
@@ -1055,7 +1055,7 @@ webapp"
nil ; predicate
'confirm))))
(let* ((account (mastodon-profile--lookup-account-in-status
- user-handle (mastodon-profile--toot-json)))
+ user-handle (mastodon-profile--toot-json)))
(user-id (mastodon-profile--account-field account 'id))
(name (mastodon-profile--account-field account 'display_name))
(url (mastodon-http--api (format "accounts/%s/block" user-id))))
@@ -1074,7 +1074,7 @@ webapp"
(let* ((blocks-url (mastodon-http--api (format "blocks")))
(blocks-json (mastodon-http--get-json blocks-url))
(blocked-accts (mapcar (lambda (blocked)
- (cdr (assoc 'acct blocked)))
+ (cdr (assoc 'acct blocked)))
blocks-json)))
(completing-read "Handle of user to unblock: "
blocked-accts
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 07b52e3..22eb626 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -184,9 +184,9 @@ Remove MARKER if REMOVE is non-nil, otherwise add it."
"Take ACTION on toot at point, then execute CALLBACK."
(let* ((id (mastodon-tl--property 'base-toot-id))
(url (mastodon-http--api (concat "statuses/"
- (mastodon-tl--as-string id)
- "/"
- action))))
+ (mastodon-tl--as-string id)
+ "/"
+ action))))
(let ((response (mastodon-http--post url nil nil)))
(mastodon-http--triage response callback))))
@@ -312,7 +312,7 @@ Remove MARKER if REMOVE is non-nil, otherwise add it."
(with-current-buffer response
(let* ((json-response (mastodon-http--process-json))
(content (cdr (assoc 'text json-response))))
- ;; (media (cdr (assoc 'media_attachments json-response))))
+ ;; (media (cdr (assoc 'media_attachments json-response))))
(mastodon-toot--compose-buffer nil nil)
(goto-char (point-max))
(insert content)
@@ -338,8 +338,8 @@ Remove MARKER if REMOVE is non-nil, otherwise add it."
(format "Toot already bookmarked. Remove? ")
(format "Bookmark this toot? ")))
(message (if (equal bookmarked t)
- "Bookmark removed!"
- "Toot bookmarked!")))
+ "Bookmark removed!"
+ "Toot bookmarked!")))
(when (y-or-n-p prompt)
(let ((response (mastodon-http--post url nil nil)))
(mastodon-http--triage response
@@ -496,10 +496,10 @@ eg. \"feduser@fed.social\" -> \"feduser@fed.social\"."
"Extract mentions from STATUS and process them into a string."
(interactive)
(let* ((boosted (mastodon-tl--field 'reblog status))
- (mentions
- (if boosted
- (cdr (assoc 'mentions (cdr (assoc 'reblog status))))
- (cdr (assoc 'mentions status)))))
+ (mentions
+ (if boosted
+ (cdr (assoc 'mentions (cdr (assoc 'reblog status))))
+ (cdr (assoc 'mentions status)))))
(mapconcat (lambda(x) (mastodon-toot--process-local
(cdr (assoc 'acct x))))
;; reverse does not work on vectors in 24.5
@@ -534,19 +534,19 @@ The prefix can match against both user handles and display names."
(defun mastodon-toot--mentions-completion (command &optional arg &rest ignored)
"A company completion backend for toot mentions."
- (interactive (list 'interactive))
- (cl-case command
- (interactive (company-begin-backend 'mastodon-toot--mentions-completion))
- (prefix (when (and (bound-and-true-p mastodon-toot-mode) ; if masto toot minor mode
- (save-excursion
- (forward-whitespace -1)
- (forward-whitespace 1)
- (looking-at "@")))
- ;; @ + thing before point
- (concat "@" (company-grab-symbol))))
- (candidates (mastodon-toot--mentions-company-candidates arg))
- (annotation (mastodon-toot--mentions-company-annotation arg))
- (meta (mastodon-toot--mentions-company-meta arg))))
+ (interactive (list 'interactive))
+ (cl-case command
+ (interactive (company-begin-backend 'mastodon-toot--mentions-completion))
+ (prefix (when (and (bound-and-true-p mastodon-toot-mode) ; if masto toot minor mode
+ (save-excursion
+ (forward-whitespace -1)
+ (forward-whitespace 1)
+ (looking-at "@")))
+ ;; @ + thing before point
+ (concat "@" (company-grab-symbol))))
+ (candidates (mastodon-toot--mentions-company-candidates arg))
+ (annotation (mastodon-toot--mentions-company-annotation arg))
+ (meta (mastodon-toot--mentions-company-meta arg))))
(defun mastodon-toot--reply ()
"Reply to toot at `point'."
@@ -803,38 +803,38 @@ REPLY-JSON is the full JSON of the toot being replied to."
"Update the status fields in the header based on the current state."
(ignore-errors ;; called from after-change-functions so let's not leak errors
(let ((inhibit-read-only t)
- (header-region (mastodon-tl--find-property-range 'toot-post-header
+ (header-region (mastodon-tl--find-property-range 'toot-post-header
+ (point-min)))
+ (count-region (mastodon-tl--find-property-range 'toot-post-counter
(point-min)))
- (count-region (mastodon-tl--find-property-range 'toot-post-counter
+ (visibility-region (mastodon-tl--find-property-range
+ 'toot-post-visibility (point-min)))
+ (nsfw-region (mastodon-tl--find-property-range 'toot-post-nsfw-flag
(point-min)))
- (visibility-region (mastodon-tl--find-property-range
- 'toot-post-visibility (point-min)))
- (nsfw-region (mastodon-tl--find-property-range 'toot-post-nsfw-flag
- (point-min)))
- (cw-region (mastodon-tl--find-property-range 'toot-post-cw-flag
- (point-min))))
- (add-text-properties (car count-region) (cdr count-region)
- (list 'display
- (format "%s/%s characters"
- (- (point-max) (cdr header-region))
- mastodon-toot--max-toot-chars)))
- (add-text-properties (car visibility-region) (cdr visibility-region)
- (list 'display
- (format "Visibility: %s"
- (if (equal
- mastodon-toot--visibility
- "private")
- "followers-only"
- mastodon-toot--visibility))))
- (add-text-properties (car nsfw-region) (cdr nsfw-region)
- (list 'display (if mastodon-toot--content-nsfw
- (if mastodon-toot--media-attachments
- "NSFW" "NSFW (no effect until attachments added)")
- "")
- 'face 'mastodon-cw-face))
- (add-text-properties (car cw-region) (cdr cw-region)
- (list 'invisible (not mastodon-toot--content-warning)
- 'face 'mastodon-cw-face)))))
+ (cw-region (mastodon-tl--find-property-range 'toot-post-cw-flag
+ (point-min))))
+ (add-text-properties (car count-region) (cdr count-region)
+ (list 'display
+ (format "%s/%s characters"
+ (- (point-max) (cdr header-region))
+ mastodon-toot--max-toot-chars)))
+ (add-text-properties (car visibility-region) (cdr visibility-region)
+ (list 'display
+ (format "Visibility: %s"
+ (if (equal
+ mastodon-toot--visibility
+ "private")
+ "followers-only"
+ mastodon-toot--visibility))))
+ (add-text-properties (car nsfw-region) (cdr nsfw-region)
+ (list 'display (if mastodon-toot--content-nsfw
+ (if mastodon-toot--media-attachments
+ "NSFW" "NSFW (no effect until attachments added)")
+ "")
+ 'face 'mastodon-cw-face))
+ (add-text-properties (car cw-region) (cdr cw-region)
+ (list 'invisible (not mastodon-toot--content-warning)
+ 'face 'mastodon-cw-face)))))
(defun mastodon-toot--compose-buffer (reply-to-user reply-to-id &optional reply-json)
"Create a new buffer to capture text for a new toot.
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index d405bed..826787a 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -204,8 +204,8 @@ Use. e.g. \"%c\" for your locale's date and time format."
"favourites"
"search"))
(buffer (cl-some (lambda (el)
- (get-buffer (concat "*mastodon-" el "*")))
- tls))) ; return first buff that exists
+ (get-buffer (concat "*mastodon-" el "*")))
+ tls))) ; return first buff that exists
(if buffer
(switch-to-buffer buffer)
(mastodon-tl--get-home-timeline)