aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-08 09:30:04 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-08 09:30:04 +0200
commit74f475a1fd3f69358c6f20c2cb37734509b2799f (patch)
tree540e0a81b304c2654164440e9bd016bd9f455b73 /lisp
parent8db980e433bce0307802663379b84acb51051200 (diff)
audit more of toot.el, kbinds, reply in docs
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-toot.el23
1 files changed, 8 insertions, 15 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 3d8c1f3..47ab605 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -1360,17 +1360,14 @@ LONGEST is the length of the longest binding."
(defun mastodon-toot--formatted-kbinds-longest (kbinds-list)
"Return the length of the longest item in KBINDS-LIST."
- (let ((lengths (mapcar (lambda (x)
- (length x))
- kbinds-list)))
+ (let ((lengths (mapcar #'length kbinds-list)))
(car (sort lengths #'>))))
(defun mastodon-toot--make-mode-docs ()
"Create formatted documentation text for the mastodon-toot-mode."
(let* ((kbinds (mastodon-toot--get-mode-kbinds))
- (longest-kbind
- (mastodon-toot--formatted-kbinds-longest
- (mastodon-toot--format-kbinds kbinds))))
+ (longest-kbind (mastodon-toot--formatted-kbinds-longest
+ (mastodon-toot--format-kbinds kbinds))))
(concat
" Compose a new toot here. The following keybindings are available:"
(mapconcat #'identity
@@ -1383,15 +1380,12 @@ LONGEST is the length of the longest binding."
"Format a REPLY-TEXT for display in compose buffer docs."
(let* ((rendered (mastodon-tl--render-text reply-text))
(no-props (substring-no-properties rendered))
- ;; FIXME: this regex replaces \n at end of every post
- ;; so we have to trim:
+ ;; FIXME: this replaces \n at end of every post, so we have to trim:
(no-newlines (string-trim
(replace-regexp-in-string "[\n]+" " " no-props)))
(reply-to (concat " Reply to: \"" no-newlines "\""))
- (crop (truncate-string-to-width
- ;; (string-limit
- reply-to
- mastodon-toot-orig-in-reply-length)))
+ (crop (truncate-string-to-width reply-to
+ mastodon-toot-orig-in-reply-length)))
(if (> (length no-newlines)
(length crop)) ; we cropped:
(concat crop "\n")
@@ -1457,9 +1451,8 @@ The default is given by `mastodon-toot--default-reply-visibility'."
"If REPLY-TO-USER is provided, inject their handle into the message.
If REPLY-TO-ID is provided, set `mastodon-toot--reply-to-id'.
REPLY-JSON is the full JSON of the toot being replied to."
- (let ((reply-visibility
- (mastodon-toot--most-restrictive-visibility
- (alist-get 'visibility reply-json)))
+ (let ((reply-visibility (mastodon-toot--most-restrictive-visibility
+ (alist-get 'visibility reply-json)))
(reply-cw (alist-get 'spoiler_text reply-json)))
(when reply-to-user
(when (> (length reply-to-user) 0) ; self is "" unforch