diff options
-rw-r--r-- | README.org | 6 | ||||
-rw-r--r-- | lisp/mastodon-discover.el | 2 | ||||
-rw-r--r-- | lisp/mastodon-search.el | 4 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 15 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 62 | ||||
-rw-r--r-- | mastodon.info | 47 | ||||
-rw-r--r-- | mastodon.texi | 12 |
7 files changed, 104 insertions, 44 deletions
@@ -188,8 +188,8 @@ not contain =:client_id= and =:client_secret=. |---------------+------------------------| | Marker | Meaning | |---------------+------------------------| -| =(B)= | I boosted this toot | -| =(F)= | I favourited this toot | +| =(🔁)= (or =(B)=) | I boosted this toot | +| =(⭐)= (or =(F)=) | I favourited this toot | | =(🔖)= (or (=K=)) | I bookmarked this toot | |---------------+------------------------| @@ -280,6 +280,8 @@ work without first loading =mastodon.el=: - =mastodon-tl--follow-tag=: Follow a tag (works like following a user) - =mastodon-tl--unfollow-tag=: Unfollow a tag - =mastodon-tl--list-followed-tags=: View a list of tags you're following. +- =mastodon-tl--followed-tags-timeline=: View a timeline of all your followed tags. +- =mastodon-tl--some-followed-tags-timleine=: View a timeline of multiple tags, from your followed tags or any other. - =mastodon-switch-to-buffer=: switch between mastodon buffers. diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el index c06de1f..57c4bd1 100644 --- a/lisp/mastodon-discover.el +++ b/lisp/mastodon-discover.el @@ -79,7 +79,7 @@ ("Views" ("h/?" "View mode help/keybindings" describe-mode) ("#" "Tag search" mastodon-tl--get-tag-timeline) - (";" "List followed tags" mastodon-tl--list-followed-tags) + (":" "List followed tags" mastodon-tl--list-followed-tags) ("F" "Federated" mastodon-tl--get-federated-timeline) ("H" "Home" mastodon-tl--get-home-timeline) ("L" "Local" mastodon-tl--get-local-timeline) diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index 9b3641b..8cfa3cb 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -191,7 +191,9 @@ user's profile note. This is also called by `mastodon-tl--get-follow-suggestions' and `mastodon-profile--insert-follow-requests'." (mapc (lambda (acct) - (insert (mastodon-search--propertize-user acct note))) + (insert (concat (mastodon-search--propertize-user acct note) + mastodon-tl--horiz-bar + "\n\n"))) json)) (defun mastodon-search--propertize-user (acct &optional note) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 7b26ecd..b4d90a2 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -414,7 +414,9 @@ With a double PREFIX arg, limit results to your own instance." (let ((list (mastodon-http--build-array-params-alist "any[]" (cdr tag)))) (while list (push (pop list) params)))) - (mastodon-tl--init (concat "tag-" (if (listp tag) "followed-tags" tag)) + (mastodon-tl--init (if (listp tag) + "tags-multiple" + (concat "tag-" tag)) (concat "timelines/tag/" (if (listp tag) ;; endpoint needs to be /tag/:sometag (car tag) tag)) @@ -2097,6 +2099,17 @@ PREFIX is sent to `mastodon-tl--show-tag-timeline', which see." (tags (mastodon-tl--map-alist 'name followed-tags-json))) (mastodon-tl--show-tag-timeline prefix tags))) +(defun mastodon-tl--some-followed-tags-timeline (&optional prefix) + "Prompt for some tags, and open a timeline for them. +The suggestions are from followed tags, but any other tags are also allowed." + (interactive "p") + (let* ((followed-tags-json (mastodon-tl--followed-tags)) + (tags (mastodon-tl--map-alist 'name followed-tags-json)) + (selection (completing-read-multiple + "Tags' timelines to view [TAB to view, comma to separate]: " + tags))) + (mastodon-tl--show-tag-timeline prefix selection))) + (defun mastodon-tl--instance-rules () "Return the rules of the user's instance." (let ((url (mastodon-http--api "instance/rules"))) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 4c0a274..6eb271d 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -228,6 +228,13 @@ send.") "\\(?2:#[0-9a-zA-Z_]+\\)" ; tag "\\b")) ; boundary +(defvar mastodon-toot-url-regex + ;; adapted from ffap-url-regexp + (concat + "\\(?2:\\(news\\(post\\)?:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://\\)" ; uri prefix + "[^ \n\t]*\\)" ; any old thing that's, i.e. we allow invalid/unwise chars + "\\b")) ; boundary + (defvar mastodon-toot-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-c C-c") #'mastodon-toot--send) @@ -764,6 +771,13 @@ to `emojify-user-emojis', and the emoji data is updated." `(("poll[multiple]" . ,(symbol-name (plist-get mastodon-toot-poll :multi)))) `(("poll[hide_totals]" . ,(symbol-name (plist-get mastodon-toot-poll :hide)))))) +(defun mastodon-toot--read-cw-string () + "Read a content warning from the minibuffer." + (when (and (not (mastodon-toot--empty-p)) + mastodon-toot--content-warning) + (read-string "Warning: " + mastodon-toot--content-warning-from-reply-or-redraft))) + (defun mastodon-toot--send () "POST contents of new-toot buffer to Mastodon instance and kill buffer. If media items have been attached and uploaded with @@ -781,16 +795,13 @@ instance to edit a toot." (mastodon-http--api (format "statuses/%s" edit-id)) (mastodon-http--api "statuses"))) - (spoiler (when (and (not (mastodon-toot--empty-p)) - mastodon-toot--content-warning) - (read-string "Warning: " - mastodon-toot--content-warning-from-reply-or-redraft))) + (cw (mastodon-toot--read-cw-string)) (args-no-media (append `(("status" . ,toot) ("in_reply_to_id" . ,mastodon-toot--reply-to-id) ("visibility" . ,mastodon-toot--visibility) ("sensitive" . ,(when mastodon-toot--content-nsfw (symbol-name t))) - ("spoiler_text" . ,spoiler) + ("spoiler_text" . ,cw) ("language" . ,mastodon-toot--language)) ;; Pleroma instances can't handle null-valued ;; scheduled_at args, so only add if non-nil @@ -816,8 +827,8 @@ instance to edit a toot." (length mastodon-toot--media-attachment-ids))))) (message "Something is wrong with your uploads. Wait for them to complete or try again.")) ((and mastodon-toot--max-toot-chars - (> (mastodon-toot--count-toot-chars toot) mastodon-toot--max-toot-chars)) - (message "Looks like your toot is longer than that maximum allowed length.")) + (> (mastodon-toot--count-toot-chars toot cw) mastodon-toot--max-toot-chars)) + (message "Looks like your toot (inc. CW) is longer than that maximum allowed length.")) ((mastodon-toot--empty-p) (message "Empty toot. Cowardly refusing to post this.")) (t @@ -828,6 +839,7 @@ instance to edit a toot." (mastodon-http--triage response (lambda () + (setq masto-poll-toot-response response) (mastodon-toot--kill) (if scheduled (message "Toot scheduled!") @@ -996,7 +1008,12 @@ If TAGS, we search for tags, else we search for handles." ;; only search when necessary: (completion-table-dynamic (lambda (_) - (mastodon-toot--fetch-completion-candidates start end))) + ;; Interruptible candidate computation + ;; suggestion from minad (d mendler), thanks! + (let ((result + (while-no-input + (mastodon-toot--fetch-completion-candidates start end)))) + (and (consp result) result)))) :exclusive 'no :annotation-function (lambda (candidate) @@ -1015,7 +1032,12 @@ If TAGS, we search for tags, else we search for handles." ;; only search when necessary: (completion-table-dynamic (lambda (_) - (mastodon-toot--fetch-completion-candidates start end :tags))) + ;; Interruptible candidate computation + ;; suggestion from minad (d mendler), thanks! + (let ((result + (while-no-input + (mastodon-toot--fetch-completion-candidates start end :tags)))) + (and (consp result) result)))) :exclusive 'no :annotation-function (lambda (candidate) @@ -1224,8 +1246,18 @@ MAX is the maximum number set by their instance." (defun mastodon-toot--read-poll-options (count length) "Read a list of options for poll with COUNT options. LENGTH is the maximum character length allowed for a poll option." - (cl-loop for x from 1 to count - collect (read-string (format "Poll option [%s/%s] [max %s chars]: " x count length)))) + (let* ((choices + (cl-loop for x from 1 to count + collect (read-string + (format "Poll option [%s/%s] [max %s chars]: " + x count length)))) + (longest (cl-reduce #'max (mapcar #'length choices)))) + (if (> longest length) + (progn + (message "looks like you went over the max length. Try again.") + (sleep-for 2) + (mastodon-toot--read-poll-options count length)) + choices))) (defun mastodon-toot--read-poll-expiry () "Prompt for a poll expiry time." @@ -1515,7 +1547,7 @@ REPLY-JSON is the full JSON of the toot being replied to." (list 'invisible (not mastodon-toot--content-warning) 'face 'mastodon-cw-face))))) -(defun mastodon-toot--count-toot-chars (toot-string) +(defun mastodon-toot--count-toot-chars (toot-string &optional cw) "Count the characters in TOOT-STRING. URLs always = 23, and domain names of handles are not counted. This is how mastodon does it." @@ -1533,7 +1565,8 @@ This is how mastodon does it." "\\b") nil t) (replace-match (match-string 2))) ; replace with handle only - (length (buffer-substring (point-min) (point-max))))) + (+ (length cw) + (length (buffer-substring (point-min) (point-max)))))) (defun mastodon-toot--save-toot-text (&rest _args) "Save the current toot text in `mastodon-toot-current-toot-text'. @@ -1601,6 +1634,9 @@ Added to `after-change-functions'." (cdr header-region)) (mastodon-toot--propertize-item mastodon-toot-handle-regex 'mastodon-display-name-face + (cdr header-region)) + (mastodon-toot--propertize-item mastodon-toot-url-regex + 'link (cdr header-region))))) (defun mastodon-toot--propertize-item (regex face start) diff --git a/mastodon.info b/mastodon.info index b1b679c..6d8ba6d 100644 --- a/mastodon.info +++ b/mastodon.info @@ -211,7 +211,7 @@ your ‘mastodon-token-file’ does not contain ‘:client_id’ and 1. Keybindings Key Action - ----------------------------------------------------------------------------------------------------- + ----------------------------------------------------------------------------------------------------------- *Help* ‘?’ Show discover menu of all bindings, if ‘discover’ is available *Timeline actions* @@ -219,9 +219,9 @@ your ‘mastodon-token-file’ does not contain ‘:client_id’ and ‘p’ Go to previous item (toot, notification, user) ‘M-n=/=<tab>’ Go to the next interesting thing that has an action ‘M-p=/=<S-tab>’ Go to the previous interesting thing that has an action - ‘F’ Open federated timeline - ‘H’ Open home timeline - ‘L’ Open local timeline + ‘F’ Open federated timeline (1 prefix arg: hide-replies, 2 prefix args: media only) + ‘H’ Open home timeline (1 prefix arg: hide-replies) + ‘L’ Open local timeline (1 prefix arg: hide-replies, 2 prefix args: media only) ‘N’ Open notifications timeline ‘@’ Open mentions-only notifications timeline ‘u’ Update current timeline @@ -233,6 +233,7 @@ your ‘mastodon-token-file’ does not contain ‘:client_id’ and ‘U’ update your profile bio note ‘;’ view instance description for toot at point ‘:’ view followed tags and load a tag timeline + ‘C-:’ view timeline of all followed tags ‘,’ view favouriters of toot at point ‘.’ view boosters of toot at point ‘/’ switch between mastodon buffers @@ -365,6 +366,8 @@ and should work without first loading ‘mastodon.el’: instance. • ‘mastodon-search--trending-tags’: View a list of trending hashtags on your instance. + • ‘mastodon-search--trending-statuses’: View a list of trending + statuses on your instance. • ‘mastodon-tl--add-toot-account-at-point-to-list’: Add the account of the toot at point to a list. @@ -636,24 +639,24 @@ Node: Usage3098 Node: Logging in to your instance3508 Node: Timelines4505 Ref: Keybindings4980 -Ref: Toot byline legend9253 -Node: Composing toots9525 -Ref: Keybindings (1)11102 -Ref: Draft toots11620 -Node: Other commands and account settings12091 -Node: Customization14914 -Node: Alternative timeline layout15700 -Node: Live-updating timelines mastodon-async-mode16077 -Node: Translating toots16913 -Node: bookmarks and mastodonel18085 -Node: Dependencies18555 -Node: Network compatibility19147 -Node: Contributing19633 -Node: Bug reports19922 -Node: Fixes and features20828 -Node: Coding style21311 -Node: Supporting mastodonel21935 -Node: Contributors22465 +Ref: Toot byline legend9469 +Node: Composing toots9741 +Ref: Keybindings (1)11318 +Ref: Draft toots11836 +Node: Other commands and account settings12307 +Node: Customization15235 +Node: Alternative timeline layout16021 +Node: Live-updating timelines mastodon-async-mode16398 +Node: Translating toots17234 +Node: bookmarks and mastodonel18406 +Node: Dependencies18876 +Node: Network compatibility19468 +Node: Contributing19954 +Node: Bug reports20243 +Node: Fixes and features21149 +Node: Coding style21632 +Node: Supporting mastodonel22256 +Node: Contributors22786 End Tag Table diff --git a/mastodon.texi b/mastodon.texi index 577f133..dee530f 100644 --- a/mastodon.texi +++ b/mastodon.texi @@ -214,7 +214,7 @@ not contain @samp{:client_id} and @samp{:client_secret}. @anchor{Keybindings}Keybindings -@multitable {aaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} +@multitable {aaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} @headitem Key @tab Action @item @@ -232,11 +232,11 @@ not contain @samp{:client_id} and @samp{:client_secret}. @item @samp{M-p=/=<S-tab>} @tab Go to the previous interesting thing that has an action @item @samp{F} -@tab Open federated timeline +@tab Open federated timeline (1 prefix arg: hide-replies, 2 prefix args: media only) @item @samp{H} -@tab Open home timeline +@tab Open home timeline (1 prefix arg: hide-replies) @item @samp{L} -@tab Open local timeline +@tab Open local timeline (1 prefix arg: hide-replies, 2 prefix args: media only) @item @samp{N} @tab Open notifications timeline @item @samp{@@} @@ -259,6 +259,8 @@ not contain @samp{:client_id} and @samp{:client_secret}. @tab view instance description for toot at point @item @samp{:} @tab view followed tags and load a tag timeline +@item @samp{C-:} +@tab view timeline of all followed tags @item @samp{,} @tab view favouriters of toot at point @item @samp{.} @@ -457,6 +459,8 @@ that the author of the toot at point is on. @item @samp{mastodon-search--trending-tags}: View a list of trending hashtags on your instance. +@item +@samp{mastodon-search--trending-statuses}: View a list of trending statuses on your instance. @end itemize |