From ff658d204f7e4c921555d2f431ed5658c8019ea0 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 31 Aug 2022 15:32:27 +0200 Subject: readme contributors --- README.org | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index baa7dfa..ccb2993 100644 --- a/README.org +++ b/README.org @@ -219,7 +219,7 @@ See =M-x customize-group RET mastodon= to view all customize options. - Completion for mentions and tags - Enable custom emoji -*** live-updating timelines: =mastodon-async-mode= +*** Live-updating timelines: =mastodon-async-mode= (code taken from https://github.com/alexjgriffith/mastodon-future.el.) @@ -232,7 +232,7 @@ To enable, it, add =(require 'mastodon-async)= to your =init.el=. Then you can view a timeline with one of the commands that begin with =mastodon-async--stream-=. -*** translating toots +*** Translating toots You can translate toots with =mastodon-toot--translate-toot-text=. At the moment this requires [[https://codeberg.org/martianh/lingva.el][lingva.el]], a little interface I wrote to https://lingva.ml, to @@ -255,7 +255,7 @@ to your translator function as its text argument. Here's what (message "No toot to translate?")))) #+end_src -** dependencies +** Dependencies This version depends on the library =request= (for uploading attachments). You can install it from MELPA, or https://github.com/tkf/emacs-request. @@ -281,3 +281,14 @@ PRs, issues, and feature requests are very welcome! 1. In an [[https://github.com/jdenen/mastodon.el/issues][issue]], let me know that you're working to fix it. 2. Fork the repository and create a branch off of =develop=. 3. Create a pull request referencing the issue from step 1. + +** Contributors: + +=mastodon.el= is a the work of a number of people. + +Some significant contributors are: + +- https://github.com/jdenen [original author] +- https://github.com/ieure +- https://alexjgriffith.itch.io +- https://github.com/hdurer -- cgit v1.2.3 From c08d3e978f52855a91ec386e7b5d8a6857c855b2 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 31 Aug 2022 15:32:27 +0200 Subject: readme contributors --- README.org | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index baa7dfa..a9934d4 100644 --- a/README.org +++ b/README.org @@ -219,7 +219,7 @@ See =M-x customize-group RET mastodon= to view all customize options. - Completion for mentions and tags - Enable custom emoji -*** live-updating timelines: =mastodon-async-mode= +*** Live-updating timelines: =mastodon-async-mode= (code taken from https://github.com/alexjgriffith/mastodon-future.el.) @@ -232,7 +232,7 @@ To enable, it, add =(require 'mastodon-async)= to your =init.el=. Then you can view a timeline with one of the commands that begin with =mastodon-async--stream-=. -*** translating toots +*** Translating toots You can translate toots with =mastodon-toot--translate-toot-text=. At the moment this requires [[https://codeberg.org/martianh/lingva.el][lingva.el]], a little interface I wrote to https://lingva.ml, to @@ -255,7 +255,7 @@ to your translator function as its text argument. Here's what (message "No toot to translate?")))) #+end_src -** dependencies +** Dependencies This version depends on the library =request= (for uploading attachments). You can install it from MELPA, or https://github.com/tkf/emacs-request. @@ -281,3 +281,15 @@ PRs, issues, and feature requests are very welcome! 1. In an [[https://github.com/jdenen/mastodon.el/issues][issue]], let me know that you're working to fix it. 2. Fork the repository and create a branch off of =develop=. 3. Create a pull request referencing the issue from step 1. + +** Contributors: + +=mastodon.el= is a the work of a number of people. + +Some significant contributors are: + +- https://github.com/jdenen [original author] +- https://github.com/ieure +- https://alexjgriffith.itch.io +- https://github.com/hdurer +- https://codeberg.org/Red_Starfish -- cgit v1.2.3 From 3642927d8c60faee3cc7aea1136d33bce7e1a381 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 31 Aug 2022 15:32:27 +0200 Subject: readme contributors --- README.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.org b/README.org index a9934d4..b950681 100644 --- a/README.org +++ b/README.org @@ -289,7 +289,7 @@ PRs, issues, and feature requests are very welcome! Some significant contributors are: - https://github.com/jdenen [original author] -- https://github.com/ieure +- http://atomized.org - https://alexjgriffith.itch.io - https://github.com/hdurer - https://codeberg.org/Red_Starfish -- cgit v1.2.3 From 3ec2f7814aa11f860658e4e995ea4f8accc9499a Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 2 Sep 2022 08:33:04 +0200 Subject: work on printing instance details more work on printing instance details readme - instance description more more work on printing instance details more more more work on printing instance details --- README.org | 18 ++++--- lisp/mastodon-tl.el | 141 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 122 insertions(+), 37 deletions(-) diff --git a/README.org b/README.org index 815e99f..a2b047a 100644 --- a/README.org +++ b/README.org @@ -99,7 +99,7 @@ restart Emacs and follow the steps again. =M-x mastodon= -Opens a =*mastodon-home*= buffer in the major mode and displays toots. You +Opens a =*mastodon-home*= buffer in the major mode and displays toots. If your credentials are not yet saved, you will be prompted for email and password. The app registration process will take place if your =mastodon-token-file= does not contain =:client_id= and =:client_secret=. @@ -204,6 +204,15 @@ You can download and use your instance's custom emoji | =C-c C-e= | add emoji (if =emojify= installed) | |---------+----------------------------------| +*** Other commands and account settings: + +- =mastodon-tl-view-instance-description=: View information about the instance that the author of the toot at point is on. + +- =mastodon-profile-update-display-name=: Update the display name for your account. +- =mastodon-profile-set-default-toot-visibility=: Set the default visibility for your toots. +- =mastodon-profile-account-locked-toggle=: Toggle the locked status of your account. Locked accounts have to manually approve follow requests. +- =mastodon-profile-account-discoverable-toggle=: Toggle the discoverable status of your account. Non-discoverable accounts are not listed in the profile directory. + *** Customization See =M-x customize-group RET mastodon= to view all customize options. @@ -220,13 +229,6 @@ See =M-x customize-group RET mastodon= to view all customize options. - Completion for mentions and tags - Enable custom emoji -*** Account settings: - -- =mastodon-profile-update-display-name=: Update the display name for your account. -- =mastodon-profile-set-default-toot-visibility=: Set the default visibility for your toots. -- =mastodon-profile-account-locked-toggle=: Toggle the locked status of your account. Locked accounts have to manually approve follow requests. -- =mastodon-profile-account-discoverable-toggle=: Toggle the discoverable status of your account. Non-discoverable accounts are not listed in the profile directory. - *** Live-updating timelines: =mastodon-async-mode= (code taken from https://github.com/alexjgriffith/mastodon-future.el.) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index d74f003..7092352 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -34,7 +34,7 @@ (require 'shr) (require 'thingatpt) ; for word-at-point (require 'time-date) -(require 'cl-lib) ; for cl-mapcar +(require 'cl-lib) (require 'mpv nil :no-error) @@ -1363,8 +1363,26 @@ RESPONSE is the JSON returned by the server." (message "Looks like there's no toot or user at point?") ,@body)) -(defun mastodon-tl-view-instance-description () - "View the details of the instance the current post's author is on." +(defun mastodon-tl-view-own-instance (&optional brief) + "View details of your own instance. +BRIEF means show fewer details." + (interactive) + (mastodon-tl-view-instance-description :user brief)) + +(defun mastodon-tl-view-own-instance-brief () + "View brief details of your own instance." + (interactive) + (mastodon-tl-view-instance-description :user :brief)) + +(defun mastodon-tl-view-instance-description-brief () + "View brief details of the instance the current post's author is on." + (interactive) + (mastodon-tl-view-instance-description nil :brief)) + +(defun mastodon-tl-view-instance-description (&optional user brief) + "View the details of the instance the current post's author is on. +USER means to show the instance details for the logged in user. +BRIEF means to show fewer details." (interactive) (mastodon-tl--do-if-toot (let* ((toot (mastodon-tl--property 'toot-json)) @@ -1378,41 +1396,106 @@ RESPONSE is the JSON returned by the server." (string-remove-prefix (concat username "@") acct))) (response (mastodon-http--get-json - (concat instance - "/api/v1/instance")))) + (if user + (mastodon-http--api "instance") + (concat instance + "/api/v1/instance"))))) (when response - (let ((buf (get-buffer-create "*mastodon-preferences*"))) + (let ((buf (get-buffer-create "*mastodon-instance*"))) (with-current-buffer buf - ;; (setq masto-test-inst-json response) (switch-to-buffer-other-window buf) (let ((inhibit-read-only t)) (erase-buffer) (special-mode) + (when brief + (setq response + (list (assoc 'uri response) + (assoc 'title response) + (assoc 'short_description response) + (assoc 'email response) + (cons 'contact_account + (list + (assoc 'username + (assoc 'contact_account response)))) + (assoc 'rules response) + (assoc 'stats response)))) (mastodon-tl--print-json-keys response) (goto-char (point-min))))))))) -(defun mastodon-tl--print-json-keys (response) - "Print the JSON keys and values in RESPONSE." - (while response - (let ((el (pop response))) - (if (equal (type-of (cdr el)) 'cons) - (progn - (setq-local left-margin 4) - (insert - (mastodon-tl--render-text - (format "%-20s: " - (prin1-to-string (car el))) - nil) - "\n") - (indent-to-left-margin) - (mastodon-tl--print-json-keys (cdr el))) - (insert - (mastodon-tl--render-text - (format "%-20s: %s" - (prin1-to-string (car el)) - (prin1-to-string (cdr el))) - nil) - "\n"))))) +(defun mastodon-tl--format-key (el pad) + "Format a key of element EL, a cons, with PAD padding." + (format (concat "%-" + (number-to-string pad) + "s: ") + (prin1-to-string (car el)))) + +(defun mastodon-tl--print-json-keys (response &optional ind) + "Print the JSON keys and values in RESPONSE. +IND is the optional indentation level to print at." + (let* ((cars (mapcar + (lambda (x) (symbol-name (car x))) + response)) + (pad (1+ (cl-reduce #'max (mapcar #'length cars))))) + (while response + (let ((el (pop response))) + (cond + ;; vector of alists (fields, instance rules): + ((and (equal (type-of (cdr el)) 'vector) + (not (seq-empty-p (cdr el))) + (equal (type-of (seq-elt (cdr el) 0)) 'cons)) + (insert + (mastodon-tl--format-key el pad) + "\n\n") + (seq-do #'mastodon-tl--print-instance-rules-or-fields (cdr el)) + (insert "\n")) + ;; vector of strings (media types): + ((and (equal (type-of (cdr el)) 'vector) + (not (seq-empty-p (cdr el))) + (< 1 (seq-length (cdr el))) + (equal (type-of (seq-elt (cdr el) 0)) 'string)) + (when ind (indent-to ind)) + (insert + (mastodon-tl--format-key el pad) + "\n" + (seq-mapcat + (lambda (x) (concat x ", ")) + (cdr el) 'string) + "\n\n")) + ;; basic nesting: + ((equal (type-of (cdr el)) 'cons) + (when ind (indent-to ind)) + (insert + (mastodon-tl--format-key el pad) + "\n\n") + (mastodon-tl--print-json-keys + (cdr el) (if ind (+ ind 4) 4))) + (t + (when ind (indent-to ind)) + (insert (mastodon-tl--format-key el pad) + " " + (mastodon-tl--newline-if-long el) + (mastodon-tl--render-text + (prin1-to-string (cdr el))) + "\n"))))))) + +(defun mastodon-tl--print-instance-rules-or-fields (alist) + "Print ALIST of instance rules or contact account fields." + (let ((key (if (alist-get 'id alist) 'id 'name)) + (value (if (alist-get 'id alist) 'text 'value))) + (indent-to 4) + (insert (format "%-5s: " + (alist-get key alist)) + (mastodon-tl--newline-if-long (assoc value alist)) + (format "%s" (mastodon-tl--render-text + (alist-get value alist))) + "\n"))) + +(defun mastodon-tl--newline-if-long (el) + "Return a newline string if the cdr of EL is over 50 characters long." + (if (and (sequencep (cdr el)) + (< 50 (length (cdr el)))) + "\n" + "")) (defun mastodon-tl--follow-user (user-handle &optional notify) "Query for USER-HANDLE from current status and follow that user. -- cgit v1.2.3 From d7c388eb997056fe954faa6ff85a1fd95ef7f691 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 3 Sep 2022 14:51:22 +0200 Subject: url-lookkup: fix loading profile fun: just use the search JSON --- lisp/mastodon.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 13a410b..aca2230 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -296,8 +296,7 @@ not, just browse the URL in the normal fashion." (alist-get 'accounts response))) (let* ((accounts (assoc 'accounts response)) (account (seq-first (cdr accounts))) - (account-acct (alist-get 'acct account))) - (mastodon-profile--show-user account-acct))) + (mastodon-profile--make-author-buffer account))) (t (browse-url query)))))))) -- cgit v1.2.3 From 113e33bf8effec6d5568104474b25ef67635334b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 3 Sep 2022 14:51:22 +0200 Subject: url-lookup: fix loading profile fun: just use the search JSON --- lisp/mastodon.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 13a410b..9ff7106 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -296,8 +296,7 @@ not, just browse the URL in the normal fashion." (alist-get 'accounts response))) (let* ((accounts (assoc 'accounts response)) (account (seq-first (cdr accounts))) - (account-acct (alist-get 'acct account))) - (mastodon-profile--show-user account-acct))) + (mastodon-profile--make-author-buffer account)))) (t (browse-url query)))))))) -- cgit v1.2.3 From cc6e4026e03e3c075ae670cd11f2a53981a830a8 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 3 Sep 2022 16:02:11 +0200 Subject: docstring --- lisp/mastodon.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 4994fed..93b24b3 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -269,7 +269,8 @@ If REPLY-JSON is the json of the toot being replied to." ;;;###autoload (defun mastodon-url-lookup (&optional query-url) - "Do a WebFinger lookup for a URL. + "If QUERY-URL resembles a mastodon link, try to load in `mastodon.el'. +Does a WebFinger lookup. URL can be arg QUERY-URL, or URL at point, or provided by the user. If a status or account is found, load it in `mastodon.el', if not, just browse the URL in the normal fashion." -- cgit v1.2.3 From a51d0b0385c60728a2d2477edef1180761ff64e7 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 3 Sep 2022 16:45:45 +0200 Subject: fix http-get-retrieves test --- test/mastodon-http-tests.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/mastodon-http-tests.el b/test/mastodon-http-tests.el index dc4aa76..57b52a4 100644 --- a/test/mastodon-http-tests.el +++ b/test/mastodon-http-tests.el @@ -53,9 +53,9 @@ Strict-Transport-Security: max-age=31536000 (ert-deftest mastodon-http--get-retrieves-endpoint () "Should make a `url-retrieve' of the given URL." (with-mock - (mock (mastodon-http--url-retrieve-synchronously "https://foo.bar/baz")) + (mock (mastodon-http--url-retrieve-synchronously "https://foo.bar/baz" nil)) (mock (mastodon-auth--access-token) => "test-token") - (mastodon-http--get "https://foo.bar/baz"))) + (mastodon-http--get "https://foo.bar/baz" nil))) (ert-deftest mastodon-http--triage-success () "Should run success function for 200 HTML response." -- cgit v1.2.3 From 23013ff6daa54c8268c6f5b791270b78e1ac7eb0 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 3 Sep 2022 18:32:37 +0200 Subject: improve masto-url-p regexes --- lisp/mastodon.el | 62 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 93b24b3..0c6104f 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -279,43 +279,43 @@ not, just browse the URL in the normal fashion." (url-get-url-at-point) (get-text-property (point) 'shr-url) (read-string "Lookup URL: ")))) - ;; TODO: test for a likely masto link and just browse-url if not - (save-match-data - (if (not (mastodon--masto-url-p query)) - (browse-url query) - (message "Performing lookup...") - (let* ((url (format "%s/api/v2/search" mastodon-instance-url)) - (param (concat "resolve=t")) ; webfinger - (response (mastodon-http--get-search-json url query param :silent))) - (cond ((not (seq-empty-p - (alist-get 'statuses response))) - (let* ((statuses (assoc 'statuses response)) - (status (seq-first (cdr statuses))) - (status-id (alist-get 'id status))) - (mastodon-tl--thread status-id))) - ((not (seq-empty-p - (alist-get 'accounts response))) - (let* ((accounts (assoc 'accounts response)) - (account (seq-first (cdr accounts)))) - (mastodon-profile--make-author-buffer account))) - (t - (browse-url query)))))))) + (if (not (mastodon--masto-url-p query)) + (browse-url query) + (message "Performing lookup...") + (let* ((url (format "%s/api/v2/search" mastodon-instance-url)) + (param (concat "resolve=t")) ; webfinger + (response (mastodon-http--get-search-json url query param :silent))) + (cond ((not (seq-empty-p + (alist-get 'statuses response))) + (let* ((statuses (assoc 'statuses response)) + (status (seq-first (cdr statuses))) + (status-id (alist-get 'id status))) + (mastodon-tl--thread status-id))) + ((not (seq-empty-p + (alist-get 'accounts response))) + (let* ((accounts (assoc 'accounts response)) + (account (seq-first (cdr accounts)))) + (mastodon-profile--make-author-buffer account))) + (t + (browse-url query))))))) (defun mastodon--masto-url-p (query) "Check if QUERY resembles a fediverse URL." - ;; regex test the url: ;; calqued off https://github.com/tuskyapp/Tusky/blob/c8fc2418b8f5458a817bba221d025b822225e130/app/src/main/java/com/keylesspalace/tusky/BottomSheetActivity.kt ;; TODO: remove domain and add ^ to regex: ;; (let ((query-path (url-file-nondirectory query))) - (or (string-match "/@" query) - (string-match "/users/[[:alnum:]]+$" query) - (string-match "/notice/[[:alnum:]]+$" query) - (string-match "/objects/[-a-f0-9]+$" query) - (string-match "/notes/[a-z0-9]+$" query) - (string-match "/display/[-a-f0-9]+$" query) - (string-match "/profile/[[:alpha:]]+$" query) - (string-match "/p/[[:alpha:]]+/[[:digit:]]+$" query) - (string-match "/[[:alpha:]]+$" query))) + (let* ((uri-parsed (url-generic-parse-url query)) + (query (url-filename uri-parsed))) + (save-match-data + (or (string-match "^/@[[:alnum:]]+/[[:digit:]]+$" query) + (string-match "^/users/[[:alnum:]]+$" query) + (string-match "^/notice/[[:alnum:]]+$" query) + (string-match "^/objects/[-a-f0-9]+$" query) + (string-match "^/notes/[a-z0-9]+$" query) + (string-match "^/display/[-a-f0-9]+$" query) + (string-match "^/profile/[[:alpha:]]+$" query) + (string-match "^/p/[[:alpha:]]+/[[:digit:]]+$" query) + (string-match "^/[[:alpha:]]+$" query))))) ;;;###autoload (add-hook 'mastodon-mode-hook (lambda () -- cgit v1.2.3 From 479bdf4becba035a74243514ce82d37c12d02bfa Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 14:06:59 +0200 Subject: improve masto-url-p regexes for users --- lisp/mastodon.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 0c6104f..d773d24 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -302,12 +302,12 @@ not, just browse the URL in the normal fashion." (defun mastodon--masto-url-p (query) "Check if QUERY resembles a fediverse URL." ;; calqued off https://github.com/tuskyapp/Tusky/blob/c8fc2418b8f5458a817bba221d025b822225e130/app/src/main/java/com/keylesspalace/tusky/BottomSheetActivity.kt - ;; TODO: remove domain and add ^ to regex: - ;; (let ((query-path (url-file-nondirectory query))) + ;; thx to Conny Duck! (let* ((uri-parsed (url-generic-parse-url query)) (query (url-filename uri-parsed))) (save-match-data - (or (string-match "^/@[[:alnum:]]+/[[:digit:]]+$" query) + (or (string-match "^/@[^/]+$" query) + (string-match "^/@[^/]+/[[:digit:]]+$" query) (string-match "^/users/[[:alnum:]]+$" query) (string-match "^/notice/[[:alnum:]]+$" query) (string-match "^/objects/[-a-f0-9]+$" query) -- cgit v1.2.3 From 6eef69b247a20cea4bb1fc598cfc9e69deb7fb91 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 14:56:33 +0200 Subject: url-lookup: shr-browse-url not browse-url, for keymap --- lisp/mastodon.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index d773d24..5d41858 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -280,7 +280,7 @@ not, just browse the URL in the normal fashion." (get-text-property (point) 'shr-url) (read-string "Lookup URL: ")))) (if (not (mastodon--masto-url-p query)) - (browse-url query) + (shr-browse-url query) (message "Performing lookup...") (let* ((url (format "%s/api/v2/search" mastodon-instance-url)) (param (concat "resolve=t")) ; webfinger -- cgit v1.2.3 From 5073a82d39914e1b753005520219ab949cd13f97 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 14:56:33 +0200 Subject: url-lookup: shr-browse-url in masto-mode, otherwise browse-url --- lisp/mastodon.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 5d41858..4578e13 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -280,7 +280,9 @@ not, just browse the URL in the normal fashion." (get-text-property (point) 'shr-url) (read-string "Lookup URL: ")))) (if (not (mastodon--masto-url-p query)) - (shr-browse-url query) + (if (equal major-mode 'mastodon-mode) + (shr-browse-url query) ;; keep our shr keymap + (browse-url query)) (message "Performing lookup...") (let* ((url (format "%s/api/v2/search" mastodon-instance-url)) (param (concat "resolve=t")) ; webfinger -- cgit v1.2.3 From c1cb95517a37e3f1d3a92d7cc854d8b772d7ef12 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 21:42:58 +0200 Subject: add Cask dep persist --- Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/Cask b/Cask index 3f7825f..a960f81 100644 --- a/Cask +++ b/Cask @@ -6,6 +6,7 @@ (depends-on "request" "0.3.0") (depends-on "seq") +(depends-on "persist") (development (depends-on "ert-runner") -- cgit v1.2.3 From 911312b84e7e132365e35ce5453a40195673f336 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 22:36:58 +0200 Subject: add mock to fix author buffer test and notifs-get --- test/mastodon-notifications-tests.el | 5 ++++- test/mastodon-profile-tests.el | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/test/mastodon-notifications-tests.el b/test/mastodon-notifications-tests.el index f5cc4c5..7c87933 100644 --- a/test/mastodon-notifications-tests.el +++ b/test/mastodon-notifications-tests.el @@ -187,7 +187,10 @@ "Ensure get request format for notifictions is accurate." (let ((mastodon-instance-url "https://instance.url")) (with-mock - (mock (mastodon-http--get-json "https://instance.url/api/v1/notifications" )) + (mock (mastodon-http--get-json "https://instance.url/api/v1/notifications")) + (mock (mastodon-profile-fetch-server-account-settings) + => '(max_toot_chars 1312 privacy "public" display_name "Eugen" discoverable t locked :json-false bot :json-false sensitive :json-false language "")) + (mastodon-notifications--get)))) (defun mastodon-notifications--test-type (fun sample) diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el index 817e386..640afb7 100644 --- a/test/mastodon-profile-tests.el +++ b/test/mastodon-profile-tests.el @@ -246,6 +246,8 @@ content generation in the function under test." (mock (shr-render-region * *) => nil) ;; Don't perform the actual update call at the end. ;;(mock (mastodon-tl--timeline *)) + (mock (mastodon-profile-fetch-server-account-settings) + => '(max_toot_chars 1312 privacy "public" display_name "Eugen" discoverable t locked :json-false bot :json-false sensitive :json-false language "")) (let ((mastodon-tl--show-avatars t) (mastodon-tl--display-media-p t) -- cgit v1.2.3 From cf504419334bf964e5211ab238783efb15325648 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 22:02:26 +0200 Subject: fix toot--kill test --- lisp/mastodon-toot.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 2f58bfb..5ec58dd 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -462,14 +462,13 @@ REPLY-ID, TOOT-VISIBILITY, and TOOT-CW of deleted toot are preseved." (defun mastodon-toot--kill (&optional cancel) "Kill `mastodon-toot-mode' buffer and window. CANCEL means the toot was not sent, so we save the toot text as a draft." - (with-current-buffer (get-buffer "*new toot*") - (unless (eq mastodon-toot-current-toot-text nil) - (when cancel - (cl-pushnew mastodon-toot-current-toot-text - mastodon-toot-draft-toots-list :test 'equal))) - ;; prevent some weird bug when cancelling a non-empty toot: - (delete #'mastodon-toot-save-toot-text after-change-functions) - (kill-buffer-and-window))) + (unless (eq mastodon-toot-current-toot-text nil) + (when cancel + (cl-pushnew mastodon-toot-current-toot-text + mastodon-toot-draft-toots-list :test 'equal))) + ;; prevent some weird bug when cancelling a non-empty toot: + (delete #'mastodon-toot-save-toot-text after-change-functions) + (kill-buffer-and-window)) (defun mastodon-toot--cancel () "Kill new-toot buffer/window. Does not POST content to Mastodon. -- cgit v1.2.3 From eece353104038f0776f9b67c23442813c70b8bcc Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 22:02:11 +0200 Subject: fix spoiler text and indent tl-tests --- test/mastodon-tl-tests.el | 115 +++++++++++++++++++++++--------------------- test/mastodon-toot-tests.el | 2 +- 2 files changed, 60 insertions(+), 57 deletions(-) diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el index a569c89..bb5d00f 100644 --- a/test/mastodon-tl-tests.el +++ b/test/mastodon-tl-tests.el @@ -206,10 +206,10 @@ a string or a numeric." (weeks (n) (* n (days 7))) (years (n) (* n (days 365))) (format-seconds-since (seconds) - (let ((timestamp (time-subtract (current-time) (seconds-to-time seconds)))) - (mastodon-tl--relative-time-description timestamp))) + (let ((timestamp (time-subtract (current-time) (seconds-to-time seconds)))) + (mastodon-tl--relative-time-description timestamp))) (check (seconds expected) - (should (string= (format-seconds-since seconds) expected)))) + (should (string= (format-seconds-since seconds) expected)))) (check 1 "less than a minute ago") (check 59 "less than a minute ago") (check 60 "one minute ago") @@ -245,33 +245,33 @@ a string or a numeric." (weeks (n) (* n (days 7))) (years (n) (* n (days 365.25))) (next-update (seconds-ago) - (let* ((timestamp (time-subtract current-time - (seconds-to-time seconds-ago)))) - (cdr (mastodon-tl--relative-time-details timestamp current-time)))) + (let* ((timestamp (time-subtract current-time + (seconds-to-time seconds-ago)))) + (cdr (mastodon-tl--relative-time-details timestamp current-time)))) (check (seconds-ago) - (let* ((timestamp (time-subtract current-time (seconds-to-time seconds-ago))) - (at-now (mastodon-tl--relative-time-description timestamp current-time)) - (at-one-second-before (mastodon-tl--relative-time-description - timestamp - (time-subtract (next-update seconds-ago) - (seconds-to-time 1)))) - (at-result (mastodon-tl--relative-time-description - timestamp - (next-update seconds-ago)))) - (when nil ;; change to t to debug test failures - (prin1 (format "\nFor %s: %s / %s" - seconds-ago - (time-to-seconds - (time-subtract (next-update seconds-ago) - timestamp)) - (round - (time-to-seconds - (time-subtract (next-update seconds-ago) - current-time)))))) - ;; a second earlier the description is the same as at current time - (should (string= at-now at-one-second-before)) - ;; but at the result time it is different - (should-not (string= at-one-second-before at-result))))) + (let* ((timestamp (time-subtract current-time (seconds-to-time seconds-ago))) + (at-now (mastodon-tl--relative-time-description timestamp current-time)) + (at-one-second-before (mastodon-tl--relative-time-description + timestamp + (time-subtract (next-update seconds-ago) + (seconds-to-time 1)))) + (at-result (mastodon-tl--relative-time-description + timestamp + (next-update seconds-ago)))) + (when nil ;; change to t to debug test failures + (prin1 (format "\nFor %s: %s / %s" + seconds-ago + (time-to-seconds + (time-subtract (next-update seconds-ago) + timestamp)) + (round + (time-to-seconds + (time-subtract (next-update seconds-ago) + current-time)))))) + ;; a second earlier the description is the same as at current time + (should (string= at-now at-one-second-before)) + ;; but at the result time it is different + (should-not (string= at-one-second-before at-result))))) (check 0) (check 1) (check 59) @@ -309,10 +309,10 @@ a string or a numeric." (let ((byline (mastodon-tl--byline mastodon-tl-test-base-toot 'mastodon-tl--byline-author 'mastodon-tl--byline-boosted)) - (handle-location 20)) + (handle-location 20)) (should (string= (substring-no-properties - byline) - "Account 42 (@acct42@example.space) 2999-99-99 00:11:22 + byline) + "Account 42 (@acct42@example.space) 2999-99-99 00:11:22 ------------ ")) (should (eq (get-text-property handle-location 'mastodon-tab-stop byline) @@ -407,19 +407,19 @@ a string or a numeric." (mock (format-time-string mastodon-toot-timestamp-format '(3 4)) => "original time") (let ((byline (mastodon-tl--byline toot - 'mastodon-tl--byline-author - 'mastodon-tl--byline-boosted)) - (handle1-location 20) - (handle2-location 65)) + 'mastodon-tl--byline-author + 'mastodon-tl--byline-boosted)) + (handle1-location 20) + (handle2-location 65)) (should (string= (substring-no-properties byline) - "Account 42 (@acct42@example.space) + "Account 42 (@acct42@example.space) Boosted Account 43 (@acct43@example.space) original time ------------ ")) (should (eq (get-text-property handle1-location 'mastodon-tab-stop byline) 'user-handle)) (should (equal (get-text-property handle1-location 'help-echo byline) - "Browse user profile of @acct42@example.space")) + "Browse user profile of @acct42@example.space")) (should (eq (get-text-property handle2-location 'mastodon-tab-stop byline) 'user-handle)) (should (equal (get-text-property handle2-location 'help-echo byline) @@ -819,13 +819,13 @@ constant." (let ((now (current-time)) markers) (cl-labels ((insert-timestamp (n) - (insert (format "\nSome text before timestamp %s:" n)) - (insert (propertize - (format "timestamp #%s" n) - 'timestamp (time-subtract now (seconds-to-time (* 60 n))) - 'display (format "unset %s" n))) - (push (copy-marker (point)) markers) - (insert " some more text."))) + (insert (format "\nSome text before timestamp %s:" n)) + (insert (propertize + (format "timestamp #%s" n) + 'timestamp (time-subtract now (seconds-to-time (* 60 n))) + 'display (format "unset %s" n))) + (push (copy-marker (point)) markers) + (insert " some more text."))) (with-temp-buffer (cl-dotimes (n 12) (insert-timestamp (+ n 2))) (setq markers (nreverse markers)) @@ -883,6 +883,9 @@ constant." (insert "some text before\n") (setq toot-start (point)) (with-mock + (mock (mastodon-profile--get-preferences-pref + 'reading:expand:spoilers) + => :json-false) (stub create-image => '(image "fake data")) (stub shr-render-region => nil) ;; Travis's Emacs doesn't have libxml (insert @@ -892,7 +895,7 @@ constant." (add-text-properties toot-start toot-end (list 'toot-json normal-toot-with-spoiler - 'toot-id (cdr (assoc 'id normal-toot-with-spoiler)))) + 'toot-id (cdr (assoc 'id normal-toot-with-spoiler)))) (goto-char toot-start) ;; (should (eq t (looking-at "This is the spoiler warning text"))) @@ -964,28 +967,28 @@ constant." (ert-deftest mastodon-tl--extract-hashtag-from-url-mastodon-link () "Should extract the hashtag from a tags url." (should (equal (mastodon-tl--extract-hashtag-from-url - "https://example.org/tags/foo" - "https://example.org") - "foo"))) + "https://example.org/tags/foo" + "https://example.org") + "foo"))) (ert-deftest mastodon-tl--extract-hashtag-from-url-other-link () "Should extract the hashtag from a tag url." (should (equal (mastodon-tl--extract-hashtag-from-url - "https://example.org/tag/foo" - "https://example.org") - "foo"))) + "https://example.org/tag/foo" + "https://example.org") + "foo"))) (ert-deftest mastodon-tl--extract-hashtag-from-url-wrong-instance () "Should not find a tag when the instance doesn't match." (should (null (mastodon-tl--extract-hashtag-from-url - "https://example.org/tags/foo" - "https://other.example.org")))) + "https://example.org/tags/foo" + "https://other.example.org")))) (ert-deftest mastodon-tl--extract-hashtag-from-url-not-tag () "Should not find a hashtag when not a tag url" (should (null (mastodon-tl--extract-hashtag-from-url - "https://example.org/@userid" - "https://example.org")))) + "https://example.org/@userid" + "https://example.org")))) (ert-deftest mastodon-tl--userhandles () "Should recognise userhandles in a toot and add the required properties to it." diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el index 0c31029..5b95cdc 100644 --- a/test/mastodon-toot-tests.el +++ b/test/mastodon-toot-tests.el @@ -89,7 +89,7 @@ mention string." (mastodon-instance-url "https://local.social")) (should (string= (mastodon-toot--mentions mastodon-toot-no-mention) "")))) -;; TODO: test y-or-no-p with matodon-toot--cancel +;; TODO: test y-or-no-p with mastodon-toot--cancel (ert-deftest mastodon-toot--kill () "Should kill the buffer when cancelling the toot." (with-mock -- cgit v1.2.3 From 2b484837ef8a0e2874284ff7be6d531e9b45d610 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 19 Sep 2022 12:04:42 +0200 Subject: add persist dep to mastodon.el file explicitly --- lisp/mastodon.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 72043cf..bc624d9 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -5,7 +5,7 @@ ;; Author: Johnson Denen ;; Maintainer: Marty Hiatt ;; Version: 1.0.0 -;; Package-Requires: ((emacs "27.1") (request "0.3.0")) +;; Package-Requires: ((emacs "27.1") (request "0.3.0") (persist "0.4")) ;; Homepage: https://codeberg.org/martianh/mastodon.el ;; This file is not part of GNU Emacs. -- cgit v1.2.3 From e8432a9bc8c2a50f4dc964884e48bc8bfd210365 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 20 Sep 2022 14:44:22 +0200 Subject: FIX getting of 'parent-toot properties in mastodon-toot--reply --- lisp/mastodon-toot.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 5ec58dd..7821949 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -761,7 +761,9 @@ Customize `mastodon-toot-display-orig-in-reply-buffer' to display text of the toot being replied to in the compose buffer." (interactive) (let* ((toot (mastodon-tl--property 'toot-json)) - (parent (mastodon-tl--property 'parent-toot)) ; for new notifs handling + ;; NB: we cannot use mastodon-tl--property for 'parent-toot + ;; because if it doesn't have one, it is fetched from next toot! + (parent (get-text-property (point) 'parent-toot)) ; for new notifs handling (id (mastodon-tl--as-string (mastodon-tl--field 'id (or parent toot)))) (account (mastodon-tl--field 'account toot)) -- cgit v1.2.3 From c917a2d0e85167dc82db14975d2d3960114d4279 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 20 Sep 2022 14:44:22 +0200 Subject: FIX getting of 'parent-toot properties in mastodon-toot--reply --- lisp/mastodon-toot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 5ec58dd..8c9cc62 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -761,7 +761,7 @@ Customize `mastodon-toot-display-orig-in-reply-buffer' to display text of the toot being replied to in the compose buffer." (interactive) (let* ((toot (mastodon-tl--property 'toot-json)) - (parent (mastodon-tl--property 'parent-toot)) ; for new notifs handling + (parent (mastodon-tl--field 'parent-toot toot)) ; for new notifs handling (id (mastodon-tl--as-string (mastodon-tl--field 'id (or parent toot)))) (account (mastodon-tl--field 'account toot)) -- cgit v1.2.3 From 6b88c28779bd64aaf56c9d1e0c5fced77a506c0a Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 21 Sep 2022 16:20:14 +0200 Subject: handle empty relationships vector in make-buffer-for can be empty when doing url-lookup on a mention --- lisp/mastodon-profile.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 012e357..7f78df7 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -461,10 +461,12 @@ Returns a list of lists." (mastodon-profile--account-field account 'statuses_count))) (relationships (mastodon-profile--relationships-get id)) - (followed-by-you (alist-get 'following - (aref relationships 0))) - (follows-you (alist-get 'followed_by - (aref relationships 0))) + (followed-by-you (when (not (seq-empty-p relationships)) + (alist-get 'following + (aref relationships 0)))) + (follows-you (when (not (seq-empty-p relationships)) + (alist-get 'followed_by + (aref relationships 0)))) (followsp (or (equal follows-you 't) (equal followed-by-you 't))) (fields (mastodon-profile--fields-get account)) (pinned (mastodon-profile--get-statuses-pinned account))) -- cgit v1.2.3 From cf02b35a4170bbde1d36a24591e11d553f0be58f Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 15 Oct 2022 22:04:55 +0200 Subject: autoload profile-account-settings in mastodon.el --- lisp/mastodon.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index bc624d9..e50d5c1 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -97,6 +97,7 @@ (autoload 'mastodon-toot--translate-toot-text "mastodon-toot")) (autoload 'mastodon-search--trending-tags "mastodon-search") (autoload 'mastodon-profile-fetch-server-account-settings "mastodon-profile") +(autoload 'mastodon-profile-account-settings "mastodon-profile") (defgroup mastodon nil "Interface with Mastodon." -- cgit v1.2.3 From 56b820eee3ce367b9028657d738ee415898b7485 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 15 Oct 2022 22:05:09 +0200 Subject: check version in woodpecker --- .woodpecker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 53952ec..a760ad8 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,6 +2,7 @@ pipeline: build: image: silex/emacs:cask commands: + - emacs --version - cask install - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit -- cgit v1.2.3 From 604fe155f2656e8a9b32398bfe2d35a59252fea5 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 15 Oct 2022 22:14:56 +0200 Subject: add emacs 27 to woodpecker --- .woodpecker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index a760ad8..f86e1a4 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -5,4 +5,10 @@ pipeline: - emacs --version - cask install - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit + build: + image: silex/emacs:27 + commands: + - emacs --version + - cask install + - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit -- cgit v1.2.3 From 7a4e4e0b04afebc432c6a13e198d2cfe61eeda83 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 15 Oct 2022 22:14:56 +0200 Subject: add emacs 27 to woodpecker --- .woodpecker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index a760ad8..4665b73 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -5,4 +5,10 @@ pipeline: - emacs --version - cask install - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit + build: + image: silex/emacs:27-ci-cask + commands: + - emacs --version + - cask install + - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit -- cgit v1.2.3 From 56d305e26c61b72ba01bdac151b142e006d2b80d Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 15 Oct 2022 22:25:43 +0200 Subject: separate pipline names + only CI on main/develop --- .woodpecker.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 4665b73..ba2c7b5 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,14 +1,15 @@ pipeline: - build: + current: image: silex/emacs:cask commands: - emacs --version - cask install - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit - build: + last: image: silex/emacs:27-ci-cask commands: - emacs --version - cask install - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit ++branches: [ main, develop ] -- cgit v1.2.3 From 220a883f14f4976ab7374c0108584c2513e806d0 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 15 Oct 2022 22:31:17 +0200 Subject: mandate 27.1 for woodpecker (debian stable) --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index ba2c7b5..df4f222 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -6,7 +6,7 @@ pipeline: - cask install - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit last: - image: silex/emacs:27-ci-cask + image: silex/emacs:27.1-ci-cask commands: - emacs --version - cask install -- cgit v1.2.3 From 57bc256ea7648ba21be2037f6d7b1328c22a8f67 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 15 Oct 2022 22:35:10 +0200 Subject: Revert "mandate 27.1 for woodpecker (debian stable)" This reverts commit 220a883f14f4976ab7374c0108584c2513e806d0. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index df4f222..ba2c7b5 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -6,7 +6,7 @@ pipeline: - cask install - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit last: - image: silex/emacs:27.1-ci-cask + image: silex/emacs:27-ci-cask commands: - emacs --version - cask install -- cgit v1.2.3 From f678fc83f777ef40e948c176b1343e4de3764856 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 3 Nov 2022 21:44:06 +0100 Subject: Revert "remove unused --append-query-string" This reverts commit e2fd67b16104ab772a4ef962613cb9f3cb3cea52. --- lisp/mastodon-http.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index f32ccd4..f73fd6b 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -173,6 +173,13 @@ Pass response buffer to CALLBACK function." (with-temp-buffer (mastodon-http--url-retrieve-synchronously url)))) +(defun mastodon-http--append-query-string (url params) + "Append PARAMS to URL as query strings and return it. + +PARAMS should be an alist as required by `url-build-query-string'." + (let ((query-string (url-build-query-string params))) + (concat url "?" query-string))) + ;; search functions: (defun mastodon-http--process-json-search () "Process JSON returned by a search query to the server." -- cgit v1.2.3 From e61ba4cccfeddce5fe0f2b4a43cbd444861cf31e Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 7 Nov 2022 13:58:34 +0100 Subject: add dash to handles regex --- lisp/mastodon-toot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 60cc4da..7a40354 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1217,7 +1217,7 @@ Added to `after-change-functions'." (mastodon-toot--propertize-item "#[1-9a-zA-Z_]+" 'success (cdr header-region)) - (mastodon-toot--propertize-item "@[1-9a-zA-Z._]+" + (mastodon-toot--propertize-item "@[1-9a-zA-Z._-]+" 'mastodon-display-name-face (cdr header-region))))) -- cgit v1.2.3 From a6cea222470efcdfaa4cafd18e0260ad153596c7 Mon Sep 17 00:00:00 2001 From: bigMouthCommie Date: Wed, 9 Nov 2022 21:25:23 +0100 Subject: Update 'README.org' changed issues links to reflect current master repository --- README.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index 2db8681..1500a3d 100644 --- a/README.org +++ b/README.org @@ -303,13 +303,13 @@ PRs, issues, feature requests, and general feedback are very welcome! *** Features -1. Create an [[https://github.com/jdenen/mastodon.el/issues][issue]] detailing the feature you'd like to add. +1. Create an [[https://codeberg.org/martianh/mastodon.el/issues][issue]] detailing the feature you'd like to add. 2. Fork the repository and create a branch off of =develop=. 3. Create a pull request referencing the issue created in step 1. *** Fixes -1. In an [[https://github.com/jdenen/mastodon.el/issues][issue]], let me know that you're working to fix it. +1. In an [[https://codeberg.org/martianh/mastodon.el/issues][issue]], let me know that you're working to fix it. 2. Fork the repository and create a branch off of =develop=. 3. Create a pull request referencing the issue from step 1. -- cgit v1.2.3 From d832e14eea6012bc05dcf3619059bef2779ed934 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 9 Nov 2022 22:04:02 +0100 Subject: readme typo --- README.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.org b/README.org index 2db8681..8b8891b 100644 --- a/README.org +++ b/README.org @@ -315,7 +315,7 @@ PRs, issues, feature requests, and general feedback are very welcome! ** Contributors: -=mastodon.el= is a the work of a number of people. +=mastodon.el= is the work of a number of people. Some significant contributors are: -- cgit v1.2.3 From 8e491d7e80235b0b7f1aa002d10c8b06163fe6ed Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 10 Nov 2022 11:33:35 +0100 Subject: readme: Nota Bene --- README.org | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.org b/README.org index 6d5c65f..b47c7ac 100644 --- a/README.org +++ b/README.org @@ -297,6 +297,14 @@ Optional dependencies: - =mpv= and =mpv.el= for viewing videos and gifs - =lingva.el= for translating toots +** Nota Bene regarding work on this library + +I resurrected this library a few years ago, and have added stacks of features and fixes over time. But I was also only scratching my own itch, in my spare time, implementing features that I wanted to use and learning Elisp. I am not a professional programmer. I never aimed to make a full-featured client, nor do I aim to provide a professional service to anyone. I have implemented some things I don't use, such as filters, but mostly I can only fix bugs with things that I regularly rely on. My main thought was that if it was at least functioning and someone was picking some low hanging fruit, and making it look less moribund, then some more capable programmer(s) might come along and dive in also. + +Please keep this in mind when requesting features that are not implemented. Feel free to open an issue and to discuss it. But please do not feel free to order things from me as though I was a service provider, unless you are willing to consider also paying me as though I were a service provider. + +The better option is most likely going to be looking at the code a little bit and seeing how you can implement the feature yourself, especially as a lot of the functionality you're likely to need is already implemented for other features. + ** Contributing PRs, issues, feature requests, and general feedback are very welcome! -- cgit v1.2.3 From c873cf79e290b02dbdc3781a9a002f709e8f06c2 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 10 Nov 2022 11:33:43 +0100 Subject: readme typos --- README.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index b47c7ac..9b55549 100644 --- a/README.org +++ b/README.org @@ -135,7 +135,7 @@ take place if your =mastodon-token-file= does not contain =:client_id= and | =I=, =c=, =d= | view, create, and delete filters | | =R=, =a=, =r= | view/accept/reject follow requests | | =G= | view follow suggestions | -| =V= | view your favorited toots | +| =V= | view your favourited toots | | =K= | view bookmarked toots | |---------------+-----------------------------------------------------------------------| | | *Toot actions* | @@ -240,7 +240,7 @@ See =M-x customize-group RET mastodon= to view all customize options. - Timestamp format - Relative timestamps - Display user avatars - - Avatar image hight + - Avatar image height - Enable image caching - Compose options: @@ -267,7 +267,7 @@ You can translate toots with =mastodon-toot--translate-toot-text=. At the moment this requires [[https://codeberg.org/martianh/lingva.el][lingva.el]], a little interface I wrote to https://lingva.ml, to be installed to work. -You could easily modify the simple function to use your emacs translator of +You could easily modify the simple function to use your Emacs translator of choice (=libretrans.el= , =google-translate=, =babel=, =go-translate=, etc.), you just need to fetch the toot's content with =(mastodon-tl--content toot)= and pass it to your translator function as its text argument. Here's what -- cgit v1.2.3 From 9411f56f9f0d3a26e5948058dd919dcf71331c6a Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 10 Nov 2022 19:02:36 +0100 Subject: FIX: -tl--get-poll - add a fallback format string --- lisp/mastodon-tl.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 6f53f93..92fd12b 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -996,7 +996,12 @@ this just means displaying toot client." ((> (plist-get parsed :hours) 0) (format "%s hours, %s minutes left" (plist-get parsed :hours) (plist-get parsed :minutes))) ((> (plist-get parsed :minutes) 0) - (format "%s minutes left" (plist-get parsed :minutes)))))) + (format "%s minutes left" (plist-get parsed :minutes))) + (t ;; we failed to guess: + (format "%s days, %s hours, %s minutes left" + (plist-get parsed :days) + (plist-get parsed :hours) + (plist-get parsed :minutes)))))) (defun mastodon-tl--poll-vote (option) "If there is a poll at point, prompt user for OPTION to vote on it." -- cgit v1.2.3 From 7d8dd00a97c73b0c2e04c37c38daf6b1c04de4c8 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 10 Nov 2022 20:44:41 +0100 Subject: FIX update profile note - params alist format --- lisp/mastodon-profile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 4aa9310..c61298e 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -270,7 +270,7 @@ JSON is the data returned by the server." (let* ((note (buffer-substring-no-properties (point-min) (point-max))) (url (mastodon-http--api "accounts/update_credentials"))) (kill-buffer-and-window) - (let ((response (mastodon-http--patch url `((note ,note))))) + (let ((response (mastodon-http--patch url `(("note" . ,note))))) (mastodon-http--triage response (lambda () (message "Profile note updated!")))))) -- cgit v1.2.3 From 404d2fce2a5a975888a499aa224c81e862f60b82 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 10 Nov 2022 20:48:11 +0100 Subject: GET verify_cred not PATCH update_creds for fetch profile note --- lisp/mastodon-profile.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index c61298e..8d5bf36 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -246,8 +246,8 @@ JSON is the data returned by the server." (defun mastodon-profile--update-user-profile-note () "Fetch user's profile note and display for editing." (interactive) - (let* ((url (mastodon-http--api "accounts/update_credentials")) - (json (mastodon-http--patch-json url)) + (let* ((url (mastodon-http--api "accounts/verify_credentials")) + (json (mastodon-http--get-json url)) (source (alist-get 'source json)) (note (alist-get 'note source)) (buffer (get-buffer-create "*mastodon-update-profile*")) -- cgit v1.2.3 From 3be939795b3d98825562201f79481a2ceaee3272 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 12 Nov 2022 16:57:50 +0100 Subject: readme NB --- README.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index 9b55549..048804d 100644 --- a/README.org +++ b/README.org @@ -299,11 +299,11 @@ Optional dependencies: ** Nota Bene regarding work on this library -I resurrected this library a few years ago, and have added stacks of features and fixes over time. But I was also only scratching my own itch, in my spare time, implementing features that I wanted to use and learning Elisp. I am not a professional programmer. I never aimed to make a full-featured client, nor do I aim to provide a professional service to anyone. I have implemented some things I don't use, such as filters, but mostly I can only fix bugs with things that I regularly rely on. My main thought was that if it was at least functioning and someone was picking some low hanging fruit, and making it look less moribund, then some more capable programmer(s) might come along and dive in also. +I resurrected this library a few years ago, and have added stacks of features and fixes over time. I do it in my spare time and tend to implement features I want to use. I am not a professional programmer. I never aimed to implement all Mastodon features, nor to provide a professional service to others. I have implemented some things I don't use, such as filters, but mostly I can only fix bugs with things that I regularly rely on. -Please keep this in mind when requesting features that are not implemented. Feel free to open an issue and to discuss it. But please do not feel free to order things from me as though I was a service provider, unless you are willing to consider also paying me as though I were a service provider. +Please keep this in mind when requesting features that are not implemented. Feel free to open an issue and start a discussion, but don't try to order things from me. -The better option is most likely going to be looking at the code a little bit and seeing how you can implement the feature yourself, especially as a lot of the functionality you're likely to need is already implemented for other features. +The better option is to look at the code and seeing how you can implement the feature yourself. A lot of the functionality you'll need is already implemented. I'm happy to give pointers on what you might use. ** Contributing -- cgit v1.2.3 From fed5c23d21b75d9a4ee8ca8a6a3e398fae483b8b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 11 Nov 2022 10:48:42 +0100 Subject: readme bug reports --- README.org | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.org b/README.org index 048804d..a285e81 100644 --- a/README.org +++ b/README.org @@ -309,6 +309,14 @@ The better option is to look at the code and seeing how you can implement the fe PRs, issues, feature requests, and general feedback are very welcome! +*** Bugs + +1. =mastodon.el= has bugs, as well as lots of room for improvement. +2. I receive very little feedback, so if I don't run into the bug it often doesn't get fixed. +3. If you run into something that seems broken, first try running =mastodon.el= in emacs with no init file (i.e. =emacs -q= (instructions and code for doing this are [[https://codeberg.org/martianh/mastodon.el/issues/300][here]]) to see if it also happens independently of your own config (it probably does). +4. Enable debug on error (=toggle-debug-on-error=), make the bug happen again, and copy the backtrace that appears. +5. Open an issue here and explain what is going on. + *** Features 1. Create an [[https://codeberg.org/martianh/mastodon.el/issues][issue]] detailing the feature you'd like to add. -- cgit v1.2.3 From ee9787e2b05878c9db8353d6321a0d04a65b0c4b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 14 Nov 2022 10:06:53 +0100 Subject: remove call to shr-browse-url for non-masto URLs --- lisp/mastodon.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index b169f00..a61aead 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -288,9 +288,12 @@ not, just browse the URL in the normal fashion." (get-text-property (point) 'shr-url) (read-string "Lookup URL: ")))) (if (not (mastodon--masto-url-p query)) - (if (equal major-mode 'mastodon-mode) - (shr-browse-url query) ;; keep our shr keymap - (browse-url query)) + ;; this doesn't work as shr-browse-url doesn't take a url arg + ;; and with no args it can't use our read-string query, but only + ;; looks for a url at point + ;; (if (equal major-mode 'mastodon-mode) + ;; (shr-browse-url query) ;; keep our shr keymap + (browse-url query) (message "Performing lookup...") (let* ((url (format "%s/api/v2/search" mastodon-instance-url)) (param (concat "resolve=t")) ; webfinger -- cgit v1.2.3 From 01575d69be8ee629968c57cac742ae742433e367 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 14 Nov 2022 12:00:03 +0100 Subject: remove commented autoloads from mastodon.el --- lisp/mastodon.el | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index a61aead..7ec6ee3 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -61,10 +61,6 @@ (autoload 'mastodon-profile--get-toot-author "mastodon-profile") (autoload 'mastodon-profile--make-author-buffer "mastodon-profile") (autoload 'mastodon-profile--show-user "mastodon-profile") -;; (autoload 'mastodon-toot--compose-buffer "mastodon-toot") -;; (autoload 'mastodon-toot--reply "mastodon-toot") -;; (autoload 'mastodon-toot--toggle-boost "mastodon-toot") -;; (autoload 'mastodon-toot--toggle-favourite "mastodon-toot") (autoload 'mastodon-discover "mastodon-discover") (autoload 'mastodon-tl--block-user "mastodon-tl") @@ -79,9 +75,6 @@ (autoload 'mastodon-notifications--follow-request-accept "mastodon-notifications") (autoload 'mastodon-notifications--follow-request-reject "mastodon-notifications") (autoload 'mastodon-search--search-query "mastodon-search") -;; (autoload 'mastodon-toot--delete-toot "mastodon-toot") -;; (autoload 'mastodon-toot--copy-toot-url "mastodon-toot") -;; (autoload 'mastodon-toot--pin-toot-toggle "mastodon-toot") (autoload 'mastodon-auth--get-account-name "mastodon-auth") ;; (autoload 'mastodon-async--stream-federated "mastodon-async") ;; (autoload 'mastodon-async--stream-local "mastodon-async") @@ -91,10 +84,8 @@ (autoload 'mastodon-profile--update-user-profile-note "mastodon-profile") (autoload 'mastodon-auth--user-acct "mastodon-auth") (autoload 'mastodon-tl--poll-vote "mastodon-http") -;; (autoload 'mastodon-toot--delete-and-redraft-toot "mastodon-toot") (autoload 'mastodon-profile--view-bookmarks "mastodon-profile") (autoload 'mastoton-tl--view-filters "mastodon-tl") -;; (autoload 'mastodon-toot--bookmark-toot-toggle "mastodon-toot") (autoload 'mastodon-tl--view-filters "mastodon-tl") (autoload 'mastodon-tl--get-follow-suggestions "mastodon-tl") (when (require 'lingva nil :no-error) -- cgit v1.2.3 From 302f4828703313057823dfcc39d01ae00eb21e86 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Nov 2022 09:49:46 +0100 Subject: prop tags/handles - tweak regex for spacing --- lisp/mastodon-toot.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 438e887..3c4c7aa 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1262,10 +1262,10 @@ Added to `after-change-functions'." ;; stops all text after a handle or mention being propertized: (set-text-properties (cdr header-region) (point-max) nil) ;; TODO: confirm allowed hashtag/handle characters: - (mastodon-toot--propertize-item "[\n\t ]\\(?2:#[1-9a-zA-Z_]+\\)[\n\t ]" + (mastodon-toot--propertize-item "\\([\n\t ]\\|^\\)\\(?2:#[1-9a-zA-Z_]+\\)\\b" 'success (cdr header-region)) - (mastodon-toot--propertize-item "[\n\t ]\\(?2:@[1-9a-zA-Z._-]+\\)[\n\t ]" + (mastodon-toot--propertize-item "\\([\n\t ]\\|^\\)\\(?2:@[1-9a-zA-Z._-]+\\)\\b" 'mastodon-display-name-face (cdr header-region))))) -- cgit v1.2.3 From 5b79975808c9d4bb04b64feeec1bb8204c0d7357 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Nov 2022 12:39:54 +0100 Subject: woodpecker fix conditional branch execution --- .woodpecker.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index ba2c7b5..a9efb82 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,15 +1,20 @@ pipeline: - current: + current-emacs: image: silex/emacs:cask - commands: - - emacs --version - - cask install - - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit - last: + when: + branch: [main, develop] + commands: + - emacs --version + - cask install + - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit + + last-emacs: image: silex/emacs:27-ci-cask - commands: - - emacs --version - - cask install - - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit + when: + branch: [main, develop] + commands: + - emacs --version + - cask install + - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit + -+branches: [ main, develop ] -- cgit v1.2.3 From 7b6aaa5a5e9986f5114f11a3d6ded93403cf7205 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Nov 2022 12:44:28 +0100 Subject: Revert "woodpecker fix conditional branch execution" This reverts commit 5b79975808c9d4bb04b64feeec1bb8204c0d7357. --- .woodpecker.yml | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index a9efb82..ba2c7b5 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,20 +1,15 @@ pipeline: - current-emacs: + current: image: silex/emacs:cask - when: - branch: [main, develop] - commands: - - emacs --version - - cask install - - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit - - last-emacs: + commands: + - emacs --version + - cask install + - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit + last: image: silex/emacs:27-ci-cask - when: - branch: [main, develop] - commands: - - emacs --version - - cask install - - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit - + commands: + - emacs --version + - cask install + - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit ++branches: [ main, develop ] -- cgit v1.2.3 From 98276c45f29d4e45955ad7649758619453423cb4 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Nov 2022 14:57:23 +0100 Subject: tweak toot prop mentions regex --- lisp/mastodon-toot.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 3c4c7aa..125eeea 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1265,9 +1265,13 @@ Added to `after-change-functions'." (mastodon-toot--propertize-item "\\([\n\t ]\\|^\\)\\(?2:#[1-9a-zA-Z_]+\\)\\b" 'success (cdr header-region)) - (mastodon-toot--propertize-item "\\([\n\t ]\\|^\\)\\(?2:@[1-9a-zA-Z._-]+\\)\\b" - 'mastodon-display-name-face - (cdr header-region))))) + (mastodon-toot--propertize-item + (concat "\\([\n\t ]\\|^\\)" ; preceding space or bol + "\\(?2:@[1-9a-zA-Z._-]+" ; a handle + "\\(@[1-9a-zA-Z._-]+\\)?\\)" ; with poss domain + "\\b") ; boundary + 'mastodon-display-name-face + (cdr header-region))))) (defun mastodon-toot--propertize-item (regex face start) "Propertize item matching REGEX with FACE starting from START." -- cgit v1.2.3 From 70557006fc25dfccd84576ac6e35713fddfd24ef Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Nov 2022 15:39:16 +0100 Subject: woodpecker branches fix --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index ba2c7b5..01b1cba 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -12,4 +12,4 @@ pipeline: - cask install - cask emacs -batch -l test/ert-helper.el -f ert-run-tests-batch-and-exit -+branches: [ main, develop ] +branches: [ main, develop ] -- cgit v1.2.3 From 043abf015275bd0b2cc71391921268267cebf30d Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 19 Nov 2022 19:05:10 +0100 Subject: readme re support --- README.org | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.org b/README.org index 99c5d01..5f1eea3 100644 --- a/README.org +++ b/README.org @@ -329,6 +329,12 @@ PRs, issues, feature requests, and general feedback are very welcome! 2. Fork the repository and create a branch off of =develop=. 3. Create a pull request referencing the issue from step 1. +** Supporting mastodon.el + +If you'd like to support continued development of =mastodon.el=, I accept donations via paypal at martianhiatus [ at ] riseup [ dot ] net. If you would prefer a different payment method, write to me at that address and I can provide IBAN or other details. + +I don't have a tech worker's income, so even a small tip would help out. + ** Contributors: =mastodon.el= is the work of a number of people. -- cgit v1.2.3 From a1f888d6ac877e9d55404376d0442ab5470461c9 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 17 Nov 2022 13:55:22 +0100 Subject: readme --- README.org | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/README.org b/README.org index 5f1eea3..e5930a4 100644 --- a/README.org +++ b/README.org @@ -297,19 +297,11 @@ Optional dependencies: - =mpv= and =mpv.el= for viewing videos and gifs - =lingva.el= for translating toots -** Nota Bene regarding work on this library - -I resurrected this library a few years ago, and have added stacks of features and fixes over time. I do it in my spare time and tend to implement features I want to use. I am not a professional programmer. I never aimed to implement all Mastodon features, nor to provide a professional service to others. I have implemented some things I don't use, such as filters, but mostly I can only fix bugs with things that I regularly rely on. - -Please keep this in mind when requesting features that are not implemented. Feel free to open an issue and start a discussion, but don't try to order things from me. - -The better option is to look at the code and seeing how you can implement the feature yourself. A lot of the functionality you'll need is already implemented. I'm happy to give pointers on what you might use. - ** Contributing PRs, issues, feature requests, and general feedback are very welcome! -*** Bugs +*** Bug reports 1. =mastodon.el= has bugs, as well as lots of room for improvement. 2. I receive very little feedback, so if I don't run into the bug it often doesn't get fixed. @@ -321,13 +313,15 @@ PRs, issues, feature requests, and general feedback are very welcome! 1. Create an [[https://codeberg.org/martianh/mastodon.el/issues][issue]] detailing the feature you'd like to add. 2. Fork the repository and create a branch off of =develop=. -3. Create a pull request referencing the issue created in step 1. +3. Run the tests and ensure that your code doesn't break any of them. +4. Create a pull request referencing the issue created in step 1. *** Fixes 1. In an [[https://codeberg.org/martianh/mastodon.el/issues][issue]], let me know that you're working to fix it. 2. Fork the repository and create a branch off of =develop=. -3. Create a pull request referencing the issue from step 1. +3. Run the tests and ensure that your code doesn't break any of them. +4. Create a pull request referencing the issue from step 1. ** Supporting mastodon.el -- cgit v1.2.3 From 91020f86cf2b19bfb3136a9a92facd77bd0ccda0 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 19 Nov 2022 19:24:43 +0100 Subject: readme fixes/features --- README.org | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/README.org b/README.org index e5930a4..5ed9e85 100644 --- a/README.org +++ b/README.org @@ -309,20 +309,13 @@ PRs, issues, feature requests, and general feedback are very welcome! 4. Enable debug on error (=toggle-debug-on-error=), make the bug happen again, and copy the backtrace that appears. 5. Open an issue here and explain what is going on. -*** Features +*** Fixes and features -1. Create an [[https://codeberg.org/martianh/mastodon.el/issues][issue]] detailing the feature you'd like to add. +1. Create an [[https://codeberg.org/martianh/mastodon.el/issues][issue]] detailing what you'd like to do. 2. Fork the repository and create a branch off of =develop=. -3. Run the tests and ensure that your code doesn't break any of them. +3. Run the tests against your code and ensure it doesn't break any of them. 4. Create a pull request referencing the issue created in step 1. -*** Fixes - -1. In an [[https://codeberg.org/martianh/mastodon.el/issues][issue]], let me know that you're working to fix it. -2. Fork the repository and create a branch off of =develop=. -3. Run the tests and ensure that your code doesn't break any of them. -4. Create a pull request referencing the issue from step 1. - ** Supporting mastodon.el If you'd like to support continued development of =mastodon.el=, I accept donations via paypal at martianhiatus [ at ] riseup [ dot ] net. If you would prefer a different payment method, write to me at that address and I can provide IBAN or other details. -- cgit v1.2.3 From 788577427993c97302d29ee8e6fbfc841f550138 Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Sun, 20 Nov 2022 15:29:33 +0100 Subject: Added a user customizable symbol list --- lisp/mastodon-tl.el | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 86a7b56..0cdb421 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -106,6 +106,21 @@ width fonts when rendering HTML text")) :group 'mastodon-tl :type '(boolean :tag "Whether to display user avatars in timelines")) +;; Various symbols using throughout timeline +;; Default comes from nerd-font (www.nerdfonts.com) +(defcustom mastodon-tl-symbols '((reply . ("" . "R")) + (boost . ("" . "B")) + (favourite . ("" . "F")) + (bookmark . ("" . "K")) + (media . ("" . "M")) + (verified . ("" . "V")) + (private . ("" . "P")) + (direct . ("" . "D"))) + "Set of symbols (or strings) to be used in timeline. If a symbol does not look right (tofu), it means your font settings do not support it." + :type '(alist :key-type symbol :value-type string) + :group 'mastodon-tl) + + (defvar-local mastodon-tl--update-point nil "When updating a mastodon buffer this is where new toots will be inserted. @@ -200,6 +215,19 @@ types of mastodon links and not just shr.el-generated ones.") "The keymap to be set for the author byline. It is active where point is placed by `mastodon-tl--goto-next-toot.'") +(defun mastodon-tl--symbol (name) + "Return the unicode symbol (as a string) corresponding to NAME. + +If symbol is not displayable, an ASCII equivalent is returned. If +NAME is not part of the symbol table, '?' is returned." + + (if-let* ((symbol (alist-get name mastodon-tl-symbols))) + (if (char-displayable-p (string-to-char (car symbol))) + (car symbol) + (cdr symbol)) + "?")) + + (defun mastodon-tl--next-tab-item () "Move to the next interesting item. @@ -551,9 +579,7 @@ this just means displaying toot client." (faved (equal 't (mastodon-tl--field 'favourited toot))) (boosted (equal 't (mastodon-tl--field 'reblogged toot))) (bookmarked (equal 't (mastodon-tl--field 'bookmarked toot))) - (bookmark-str (if (fontp (char-displayable-p #10r128278)) - "🔖" - "K")) + (bookmark-str (mastodon-tl--symbol 'bookmark)) (visibility (mastodon-tl--field 'visibility toot))) (concat ;; Boosted/favourited markers are not technically part of the byline, so @@ -575,13 +601,9 @@ this just means displaying toot client." ;; in `mastodon-tl--byline-author' (funcall author-byline toot) (cond ((equal visibility "direct") - (if (fontp (char-displayable-p #10r9993)) - " ✉" - " [direct]")) + (mastodon-tl--symbol 'direct)) ((equal visibility "private") - (if (fontp (char-displayable-p #10r128274)) - " 🔒" - " [followers]"))) + (mastodon-tl--symbol 'private)) (funcall action-byline toot) " " ;; TODO: Once we have a view for toot (responses etc.) make -- cgit v1.2.3 From 25bb8619e215bdc8715aeb3f53724ad1f9af35b1 Mon Sep 17 00:00:00 2001 From: "Nicolas P. Rougier" Date: Sun, 20 Nov 2022 15:59:49 +0100 Subject: Fix a missing parenthesis & added links to default icons --- lisp/mastodon-tl.el | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 0cdb421..1a26a54 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -108,14 +108,23 @@ width fonts when rendering HTML text")) ;; Various symbols using throughout timeline ;; Default comes from nerd-font (www.nerdfonts.com) -(defcustom mastodon-tl-symbols '((reply . ("" . "R")) - (boost . ("" . "B")) - (favourite . ("" . "F")) - (bookmark . ("" . "K")) - (media . ("" . "M")) - (verified . ("" . "V")) - (private . ("" . "P")) - (direct . ("" . "D"))) +(defcustom mastodon-tl-symbols + '(;; See https://icon-sets.iconify.design/octicon/comment-24/ + (reply . ("" . "R")) + ;; See https://icon-sets.iconify.design/octicon/reply-24/ + (boost . ("" . "B")) + ;; See https://icon-sets.iconify.design/octicon/star-fill-24/ + (favourite . ("" . "F")) + ;; See https://icon-sets.iconify.design/octicon/bookmark-24/ + (bookmark . ("" . "K")) + ;; See https://icon-sets.iconify.design/octicon/file-media-24/ + (media . ("" . "M")) + ;; See https://icon-sets.iconify.design/octicon/verified-24/ + (verified . ("" . "V")) + ;; See https://icon-sets.iconify.design/octicon/person-fill-24/ + (private . ("" . "P")) + ;; See https://icon-sets.iconify.design/octicon/location-24/ + (direct . ("" . "D"))) "Set of symbols (or strings) to be used in timeline. If a symbol does not look right (tofu), it means your font settings do not support it." :type '(alist :key-type symbol :value-type string) :group 'mastodon-tl) @@ -603,7 +612,7 @@ this just means displaying toot client." (cond ((equal visibility "direct") (mastodon-tl--symbol 'direct)) ((equal visibility "private") - (mastodon-tl--symbol 'private)) + (mastodon-tl--symbol 'private))) (funcall action-byline toot) " " ;; TODO: Once we have a view for toot (responses etc.) make -- cgit v1.2.3 From e3e3dc0227f8fd83c53a611bfb63c37595cd35cf Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 25 Nov 2022 19:53:37 +0100 Subject: filter user posts by language. NB: we flip mastodon-iso-639-1! --- lisp/mastodon-iso.el | 370 +++++++++++++++++++++++++------------------------- lisp/mastodon-tl.el | 89 ++++++++---- lisp/mastodon-toot.el | 11 +- 3 files changed, 251 insertions(+), 219 deletions(-) diff --git a/lisp/mastodon-iso.el b/lisp/mastodon-iso.el index 8baff3c..341593c 100644 --- a/lisp/mastodon-iso.el +++ b/lisp/mastodon-iso.el @@ -33,191 +33,191 @@ ;; https://github.com/Shinmera/language-codes/blob/master/data/iso-639-3.lisp (defvar mastodon-iso-639-1 - '(("ab" "Abkhazian") - ("aa" "Afar") - ("af" "Afrikaans") - ("ak" "Akan") - ("sq" "Albanian") - ("am" "Amharic") - ("ar" "Arabic") - ("an" "Aragonese") - ("hy" "Armenian") - ("as" "Assamese") - ("av" "Avaric") - ("ae" "Avestan") - ("ay" "Aymara") - ("az" "Azerbaijani") - ("bm" "Bambara") - ("ba" "Bashkir") - ("eu" "Basque") - ("be" "Belarusian") - ("bn" "Bengali") - ("bh" "Bihari languages") - ("bi" "Bislama") - ("bs" "Bosnian") - ("br" "Breton") - ("bg" "Bulgarian") - ("my" "Burmese") - ("km" "Central Khmer") - ("ch" "Chamorro") - ("ce" "Chechen") - ("zh" "Chinese") - ("cv" "Chuvash") - ("kw" "Cornish") - ("co" "Corsican") - ("cr" "Cree") - ("hr" "Croatian") - ("cs" "Czech") - ("da" "Danish") - ("dz" "Dzongkha") - ("en" "English") - ("eo" "Esperanto") - ("et" "Estonian") - ("ee" "Ewe") - ("fo" "Faroese") - ("fj" "Fijian") - ("fi" "Finnish") - ("nl" "Dutch" "Flemish") - ("fr" "French") - ("ff" "Fulah") - ("gl" "Galician") - ("lg" "Ganda") - ("ka" "Georgian") - ("de" "German") - ("el" "Greek") - ("gn" "Guarani") - ("gu" "Gujarati") - ("ht" "Haitian" "Haitian Creole") - ("ha" "Hausa") - ("he" "Hebrew") - ("hz" "Herero") - ("hi" "Hindi") - ("ho" "Hiri Motu") - ("hu" "Hungarian") - ("is" "Icelandic") - ("io" "Ido") - ("ig" "Igbo") - ("id" "Indonesian") - ("ia" "Interlingua" "Interlingua (International Auxiliary Language Association)") - ("iu" "Inuktitut") - ("ik" "Inupiaq") - ("ga" "Irish") - ("it" "Italian") - ("ja" "Japanese") - ("jp" "Japanese") - ("jv" "Javanese") - ("kl" "Kalaallisut" "Greenlandic") - ("kn" "Kannada") - ("kr" "Kanuri") - ("ks" "Kashmiri") - ("kk" "Kazakh") - ("ki" "Kikuyu" "Gikuyu") - ("rw" "Kinyarwanda") - ("kv" "Komi") - ("kg" "Kongo") - ("ko" "Korean") - ("ku" "Kurdish") - ("kj" "Kuanyama" "Kwanyama") - ("ky" "Kirghiz" "Kyrgyz") - ("lo" "Lao") - ("la" "Latin") - ("lv" "Latvian") - ("li" "Limburgan" "Limburger" "Limburgish") - ("ln" "Lingala") - ("lt" "Lithuanian") - ("lu" "Luba-Katanga") - ("lb" "Luxembourgish" "Letzeburgesch") - ("mk" "Macedonian") - ("mg" "Malagasy") - ("ms" "Malay") - ("ml" "Malayalam") - ("dv" "Divehi" "Dhivehi" "Maldivian") - ("mt" "Maltese") - ("gv" "Manx") - ("mi" "Maori") - ("mr" "Marathi") - ("mh" "Marshallese") - ("mn" "Mongolian") - ("na" "Nauru") - ("nv" "Navajo" "Navaho") - ("ng" "Ndonga") - ("ne" "Nepali") - ("nd" "Ndebele, North" "North Ndebele") - ("se" "Northern Sami") - ("no" "Norwegian") - ("nb" "Bokmål, Norwegian" "Norwegian Bokmål") - ("ny" "Chichewa" "Chewa" "Nyanja") - ("nn" "Norwegian Nynorsk" "Nynorsk, Norwegian") - ("ie" "Interlingue" "Occidental") - ("oc" "Occitan") - ("oj" "Ojibwa") - ("cu" "Church Slavic" "Old Slavonic" "Church Slavonic" "Old Bulgarian" "Old Church Slavonic") - ("or" "Oriya") - ("om" "Oromo") - ("os" "Ossetian" "Ossetic") - ("pi" "Pali") - ("fa" "Persian") - ("pl" "Polish") - ("pt" "Portuguese") - ("pa" "Panjabi" "Punjabi") - ("ps" "Pushto" "Pashto") - ("qu" "Quechua") - ("ro" "Romanian" "Moldavian" "Moldovan") - ("rm" "Romansh") - ("rn" "Rundi") - ("ru" "Russian") - ("sm" "Samoan") - ("sg" "Sango") - ("sa" "Sanskrit") - ("sc" "Sardinian") - ("gd" "Gaelic" "Scottish Gaelic") - ("sr" "Serbian") - ("sn" "Shona") - ("ii" "Sichuan Yi" "Nuosu") - ("sd" "Sindhi") - ("si" "Sinhala" "Sinhalese") - ("sk" "Slovak") - ("sl" "Slovenian") - ("so" "Somali") - ("st" "Sotho, Southern") - ("nr" "Ndebele, South" "South Ndebele") - ("es" "Spanish" "Castilian") - ("su" "Sundanese") - ("sw" "Swahili") - ("ss" "Swati") - ("sv" "Swedish") - ("tl" "Tagalog") - ("ty" "Tahitian") - ("tg" "Tajik") - ("ta" "Tamil") - ("tt" "Tatar") - ("te" "Telugu") - ("th" "Thai") - ("bo" "Tibetan") - ("ti" "Tigrinya") - ("to" "Tonga (Tonga Islands)") - ("ts" "Tsonga") - ("tn" "Tswana") - ("tr" "Turkish") - ("tk" "Turkmen") - ("tw" "Twi") - ("uk" "Ukrainian") - ("ur" "Urdu") - ("ug" "Uighur" "Uyghur") - ("uz" "Uzbek") - ("ca" "Catalan" "Valencian") - ("ve" "Venda") - ("vi" "Vietnamese") - ("vo" "Volapük") - ("wa" "Walloon") - ("cy" "Welsh") - ("fy" "Western Frisian") - ("wo" "Wolof") - ("xh" "Xhosa") - ("yi" "Yiddish") - ("yo" "Yoruba") - ("za" "Zhuang" "Chuang") - ("zu" "Zulu"))) + '(("Abkhazian" . "ab") + ("Afar" . "aa") + ("Afrikaans" . "af") + ("Akan" . "ak") + ("Albanian" . "sq") + ("Amharic" . "am") + ("Arabic" . "ar") + ("Aragonese" . "an") + ("Armenian" . "hy") + ("Assamese" . "as") + ("Avaric" . "av") + ("Avestan" . "ae") + ("Aymara" . "ay") + ("Azerbaijani" . "az") + ("Bambara" . "bm") + ("Bashkir" . "ba") + ("Basque" . "eu") + ("Belarusian" . "be") + ("Bengali" . "bn") + ("Bihari languages" . "bh") + ("Bislama" . "bi") + ("Bosnian" . "bs") + ("Breton" . "br") + ("Bulgarian" . "bg") + ("Burmese" . "my") + ("Central Khmer" . "km") + ("Chamorro" . "ch") + ("Chechen" . "ce") + ("Chinese" . "zh") + ("Chuvash" . "cv") + ("Cornish" . "kw") + ("Corsican" . "co") + ("Cree" . "cr") + ("Croatian" . "hr") + ("Czech" . "cs") + ("Danish" . "da") + ("Dzongkha" . "dz") + ("English" . "en") + ("Esperanto" . "eo") + ("Estonian" . "et") + ("Ewe" . "ee") + ("Faroese" . "fo") + ("Fijian" . "fj") + ("Finnish" . "fi") + ("Dutch" . "nl") + ("French" . "fr") + ("Fulah" . "ff") + ("Galician" . "gl") + ("Ganda" . "lg") + ("Georgian" . "ka") + ("German" . "de") + ("Greek" . "el") + ("Guarani" . "gn") + ("Gujarati" . "gu") + ("Haitian" . "ht") + ("Hausa" . "ha") + ("Hebrew" . "he") + ("Herero" . "hz") + ("Hindi" . "hi") + ("Hiri Motu" . "ho") + ("Hungarian" . "hu") + ("Icelandic" . "is") + ("Ido" . "io") + ("Igbo" . "ig") + ("Indonesian" . "id") + ("Interlingua" . "ia") + ("Inuktitut" . "iu") + ("Inupiaq" . "ik") + ("Irish" . "ga") + ("Italian" . "it") + ("Japanese" . "ja") + ("Japanese" . "jp") + ("Javanese" . "jv") + ("Kalaallisut" . "kl") + ("Kannada" . "kn") + ("Kanuri" . "kr") + ("Kashmiri" . "ks") + ("Kazakh" . "kk") + ("Kikuyu" . "ki") + ("Kinyarwanda" . "rw") + ("Komi" . "kv") + ("Kongo" . "kg") + ("Korean" . "ko") + ("Kurdish" . "ku") + ("Kuanyama" . "kj") + ("Kirghiz" . "ky") + ("Lao" . "lo") + ("Latin" . "la") + ("Latvian" . "lv") + ("Limburgan" . "li") + ("Lingala" . "ln") + ("Lithuanian" . "lt") + ("Luba-Katanga" . "lu") + ("Luxembourgish" . "lb") + ("Macedonian" . "mk") + ("Malagasy" . "mg") + ("Malay" . "ms") + ("Malayalam" . "ml") + ("Divehi" . "dv") + ("Maltese" . "mt") + ("Manx" . "gv") + ("Maori" . "mi") + ("Marathi" . "mr") + ("Marshallese" . "mh") + ("Mongolian" . "mn") + ("Nauru" . "na") + ("Navajo" . "nv") + ("Ndonga" . "ng") + ("Nepali" . "ne") + ("Ndebele, North" . "nd") + ("Northern Sami" . "se") + ("Norwegian" . "no") + ("Bokmål, Norwegian" . "nb") + ("Chichewa" . "ny") + ("Norwegian Nynorsk" . "nn") + ("Interlingue" . "ie") + ("Occitan" . "oc") + ("Ojibwa" . "oj") + ("Church Slavic" . "cu") + ("Oriya" . "or") + ("Oromo" . "om") + ("Ossetian" . "os") + ("Pali" . "pi") + ("Persian" . "fa") + ("Polish" . "pl") + ("Portuguese" . "pt") + ("Panjabi" . "pa") + ("Pushto" . "ps") + ("Quechua" . "qu") + ("Romanian" . "ro") + ("Romansh" . "rm") + ("Rundi" . "rn") + ("Russian" . "ru") + ("Samoan" . "sm") + ("Sango" . "sg") + ("Sanskrit" . "sa") + ("Sardinian" . "sc") + ("Gaelic" . "gd") + ("Serbian" . "sr") + ("Shona" . "sn") + ("Sichuan Yi" . "ii") + ("Sindhi" . "sd") + ("Sinhala" . "si") + ("Slovak" . "sk") + ("Slovenian" . "sl") + ("Somali" . "so") + ("Sotho, Southern" . "st") + ("Ndebele, South" . "nr") + ("Spanish" . "es") + ("Sundanese" . "su") + ("Swahili" . "sw") + ("Swati" . "ss") + ("Swedish" . "sv") + ("Tagalog" . "tl") + ("Tahitian" . "ty") + ("Tajik" . "tg") + ("Tamil" . "ta") + ("Tatar" . "tt") + ("Telugu" . "te") + ("Thai" . "th") + ("Tibetan" . "bo") + ("Tigrinya" . "ti") + ("Tonga (Tonga Islands)" . "to") + ("Tsonga" . "ts") + ("Tswana" . "tn") + ("Turkish" . "tr") + ("Turkmen" . "tk") + ("Twi" . "tw") + ("Ukrainian" . "uk") + ("Urdu" . "ur") + ("Uighur" . "ug") + ("Uzbek" . "uz") + ("Catalan" . "ca") + ("Venda" . "ve") + ("Vietnamese" . "vi") + ("Volapük" . "vo") + ("Walloon" . "wa") + ("Welsh" . "cy") + ("Western Frisian" . "fy") + ("Wolof" . "wo") + ("Xhosa" . "xh") + ("Yiddish" . "yi") + ("Yoruba" . "yo") + ("Zhuang" . "za") + ("Zulu" . "zu"))) ;; web UI doesn't respect these for now (defvar mastodon-iso-639-regional diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 1a726c4..dd3ce1b 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -36,6 +36,7 @@ (require 'thingatpt) ; for word-at-point (require 'time-date) (require 'cl-lib) +(require 'mastodon-iso) (require 'mpv nil :no-error) @@ -2079,16 +2080,18 @@ IND is the optional indentation level to print at." ;;; FOLLOW/BLOCK/MUTE, ETC -(defun mastodon-tl--follow-user (user-handle &optional notify) +(defun mastodon-tl--follow-user (user-handle &optional notify langs) "Query for USER-HANDLE from current status and follow that user. If NOTIFY is \"true\", enable notifications when that user posts. If NOTIFY is \"false\", disable notifications when that user posts. -Can be called to toggle NOTIFY on users already being followed." +Can be called to toggle NOTIFY on users already being followed. +LANGS is an array parameters alist of languages to filer user's posts by." (interactive (list (mastodon-tl--interactive-user-handles-get "follow"))) (mastodon-tl--do-if-toot - (mastodon-tl--do-user-action-and-response user-handle "follow" nil notify))) + (mastodon-tl--do-user-action-and-response + user-handle "follow" nil notify langs))) (defun mastodon-tl--enable-notify-user-posts (user-handle) "Query for USER-HANDLE and enable notifications when they post." @@ -2105,6 +2108,31 @@ Can be called to toggle NOTIFY on users already being followed." (mastodon-tl--interactive-user-handles-get "disable"))) (mastodon-tl--follow-user user-handle "false")) +(defun mastodon-tl--filter-user-user-posts-by-language (user-handle) + "Query for USER-HANDLE and enable notifications when they post." + (interactive + (list + (mastodon-tl--interactive-user-handles-get "filter by language"))) + (let ((langs (mastodon-tl--read-filter-langs))) + (mastodon-tl--do-if-toot + (mastodon-tl--follow-user user-handle nil langs)))) + +(defun mastodon-tl--read-filter-langs (&optional langs) + "Read language choices and return an alist array parameter. +LANGS is the accumulated array param alist if we re-run recursively." + (let* ((langs-alist langs) + (choice (completing-read "Filter user's posts by language: " + mastodon-iso-639-1))) + (when choice + (setq langs-alist + (push `("languages[]" . ,(alist-get choice mastodon-iso-639-1 + nil nil + #'string=)) + langs-alist)) + (if (y-or-n-p "Filter by another language? ") + (mastodon-tl--read-filter-langs langs-alist) + langs-alist)))) + (defun mastodon-tl--unfollow-user (user-handle) "Query for USER-HANDLE from current status and unfollow that user." (interactive @@ -2197,12 +2225,13 @@ Action must be either \"unblock\" or \"unmute\"." nil ; predicate t)))) -(defun mastodon-tl--do-user-action-and-response (user-handle action &optional negp notify) +(defun mastodon-tl--do-user-action-and-response (user-handle action &optional negp notify langs) "Do ACTION on user USER-HANDLE. NEGP is whether the action involves un-doing something. If NOTIFY is \"true\", enable notifications when that user posts. If NOTIFY is \"false\", disable notifications when that user posts. -NOTIFY is only non-nil when called by `mastodon-tl--follow-user'." +NOTIFY is only non-nil when called by `mastodon-tl--follow-user'. +LANGS is an array parameters alist of languages to filer user's posts by." (let* ((account (if negp ;; if unmuting/unblocking, we got handle from mute/block list (mastodon-profile--search-account-by-handle @@ -2218,35 +2247,41 @@ NOTIFY is only non-nil when called by `mastodon-tl--follow-user'." (name (if (not (string-empty-p (mastodon-profile--account-field account 'display_name))) (mastodon-profile--account-field account 'display_name) (mastodon-profile--account-field account 'username))) - (url (mastodon-http--api - (if notify - (format "accounts/%s/%s?notify=%s" user-id action notify) - (format "accounts/%s/%s" user-id action))))) + (args (cond (notify + `(("notify" . ,notify))) + (langs langs) + (t nil))) + (url (mastodon-http--api (format "accounts/%s/%s" user-id action)))) (if account (if (equal action "follow") ; y-or-n for all but follow - (mastodon-tl--do-user-action-function url name user-handle action notify) + (mastodon-tl--do-user-action-function url name user-handle action notify args) (when (y-or-n-p (format "%s user %s? " action name)) - (mastodon-tl--do-user-action-function url name user-handle action))) + (mastodon-tl--do-user-action-function url name user-handle action args))) (message "Cannot find a user with handle %S" user-handle)))) -(defun mastodon-tl--do-user-action-function (url name user-handle action &optional notify) +(defun mastodon-tl--do-user-action-function (url name user-handle action &optional notify args) "Post ACTION on user NAME/USER-HANDLE to URL. NOTIFY is either \"true\" or \"false\", and used when we have been called -by `mastodon-tl--follow-user' to enable or disable notifications." - (let ((response (mastodon-http--post url))) - (mastodon-http--triage response - (lambda () - (cond ((string-equal notify "true") - (message "Receiving notifications for user %s (@%s)!" - name user-handle)) - ((string-equal notify "false") - (message "Not receiving notifications for user %s (@%s)!" - name user-handle)) - ((or (string-equal action "mute") - (string-equal action "unmute")) - (message "User %s (@%s) %sd!" name user-handle action)) - ((eq notify nil) - (message "User %s (@%s) %sed!" name user-handle action))))))) +by `mastodon-tl--follow-user' to enable or disable notifications. +ARGS is an alist of any parameters to send with the request." + (let ((response (mastodon-http--post url args))) + (mastodon-http--triage + response + (lambda () + (cond ((string-equal notify "true") + (message "Receiving notifications for user %s (@%s)!" + name user-handle)) + ((string-equal notify "false") + (message "Not receiving notifications for user %s (@%s)!" + name user-handle)) + ((or (string-equal action "mute") + (string-equal action "unmute")) + (message "User %s (@%s) %sd!" name user-handle action)) + ((assoc "languages[]" args #'equal) + (message "User %s filtered by language(s): %s" name + (mapconcat #'cdr args " "))) + ((eq notify nil) + (message "User %s (@%s) %sed!" name user-handle action))))))) ;; FOLLOW TAGS diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 59a3813..21bfe96 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1117,14 +1117,11 @@ LENGTH is the maximum character length allowed for a poll option." (defun mastodon-toot--set-toot-lang () "Prompt for a language and return its two letter ISO 639 1 code." (interactive) - (let* ((langs (mapcar (lambda (x) - (cons (cadr x) - (car x))) - mastodon-iso-639-1)) - (choice (completing-read "Language for this toot: " - langs))) + (let* ((choice (completing-read "Language for this toot: " + mastodon-iso-639-1))) (setq mastodon-toot--language - (alist-get choice langs nil nil 'equal)))) + (alist-get choice mastodon-iso-639-1 nil nil 'equal)) + (message "Language set to %s" choice))) ;; we'll need to revisit this if the binds get ;; more diverse than two-chord bindings -- cgit v1.2.3 From 91836e01b1598923c7a6a8e17fba74ff92d2587e Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 25 Nov 2022 23:48:01 +0100 Subject: toot--set-toot-lang docstring --- lisp/mastodon-toot.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 59a3813..27e7ce5 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1115,7 +1115,8 @@ LENGTH is the maximum character length allowed for a poll option." ("30 days" . ,(number-to-string (* 60 60 24 30))))) (defun mastodon-toot--set-toot-lang () - "Prompt for a language and return its two letter ISO 639 1 code." + "Prompt for a language and set `mastodon-toot--language'. +Return its two letter ISO 639 1 code." (interactive) (let* ((langs (mapcar (lambda (x) (cons (cadr x) -- cgit v1.2.3 From 0c889fd275b8338aed5f173f0a7df78e23801b92 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 09:34:20 +0100 Subject: paginate profile view followers/following with link header --- lisp/mastodon-profile.el | 36 ++++++++++++++++++++++++++---------- lisp/mastodon-tl.el | 23 +++++++++++++++-------- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 3ba00b9..658b1d4 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -71,6 +71,9 @@ (autoload 'mastodon-tl--get-endpoint "mastodon-tl.el") (autoload 'mastodon-toot--get-max-toot-chars "mastodon-toot") (autoload 'mastodon-tl--add-account-to-list "mastodon-tl") +(autoload 'mastodon-http--get-response "mastodon-http") +(autoload 'mastodon-tl--get-link-header-from-response "mastodon-tl") +(autoload 'mastodon-tl--set-buffer-spec "mastodon-tl") (defvar mastodon-instance-url) (defvar mastodon-tl--buffer-spec) @@ -186,7 +189,9 @@ NO-REBLOGS means do not display boosts in statuses." (mastodon-profile--make-profile-buffer-for mastodon-profile--account "following" - #'mastodon-profile--add-author-bylines) + #'mastodon-profile--add-author-bylines + nil + :headers) (error "Not in a mastodon profile"))) (defun mastodon-profile--open-followers () @@ -196,7 +201,9 @@ NO-REBLOGS means do not display boosts in statuses." (mastodon-profile--make-profile-buffer-for mastodon-profile--account "followers" - #'mastodon-profile--add-author-bylines) + #'mastodon-profile--add-author-bylines + nil + :headers) (error "Not in a mastodon profile"))) (defun mastodon-profile--view-favourites () @@ -552,16 +559,25 @@ FIELDS means provide a fields vector fetched by other means." (defun mastodon-profile--make-profile-buffer-for (account endpoint-type update-function - &optional no-reblogs) + &optional no-reblogs headers) "Display profile of ACCOUNT, using ENDPOINT-TYPE and UPDATE-FUNCTION. -NO-REBLOGS means do not display boosts in statuses." +NO-REBLOGS means do not display boosts in statuses. +HEADERS means also fetch link headers for pagination." (let* ((id (mastodon-profile--account-field account 'id)) (args (when no-reblogs '(("exclude_reblogs" . "t")))) (url (mastodon-http--api (format "accounts/%s/%s" id endpoint-type))) (acct (mastodon-profile--account-field account 'acct)) (buffer (concat "*mastodon-" acct "-" endpoint-type "*")) + (response (if headers + (mastodon-http--get-response url args) + (mastodon-http--get-json url args))) + (json (if headers (car response) response)) + (endpoint (format "accounts/%s/%s" id endpoint-type)) + (link-header (when headers + (mastodon-tl--get-link-header-from-response + (cdr response)))) + (note (mastodon-profile--account-field account 'note)) - (json (mastodon-http--get-json url args)) (locked (mastodon-profile--account-field account 'locked)) (followers-count (mastodon-tl--as-string (mastodon-profile--account-field @@ -585,11 +601,11 @@ NO-REBLOGS means do not display boosts in statuses." (switch-to-buffer buffer) (mastodon-mode) (mastodon-profile-mode) - (setq mastodon-profile--account account - mastodon-tl--buffer-spec - `(buffer-name ,buffer - endpoint ,(format "accounts/%s/%s" id endpoint-type) - update-function ,update-function)) + (setq mastodon-profile--account account) + (mastodon-tl--set-buffer-spec buffer + endpoint + update-function + link-header) (let* ((inhibit-read-only t) (is-statuses (string= endpoint-type "statuses")) (is-followers (string= endpoint-type "followers")) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 1a726c4..a87cd73 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -136,10 +136,6 @@ If nil `(point-min)' is used instead.") (defvar-local mastodon-tl--timestamp-update-timer nil "The timer that, when set will scan the buffer to update the timestamps.") -(defvar mastodon-tl--link-header-buffers - '("*mastodon-favourites*" "*mastodon-bookmarks*") - "A list of buffers that use link headers for pagination.") - ;; KEYMAPS (defvar mastodon-tl--link-keymap @@ -2327,11 +2323,22 @@ For use after e.g. deleting a toot." (param (cadr split))) (concat url-base "&" param))) +(defun mastodon-tl--use-link-header-p () + "Return t if we are in a view that uses Link header pagination. +Currently this includes favourites, bookmarks, and profile pages +when showing followers or accounts followed." + (let ((buf (buffer-name (current-buffer))) + (endpoint (mastodon-tl--get-endpoint))) + (or (member buf '("*mastodon-favourites*" "*mastodon-bookmarks*")) + (and (string-prefix-p "accounts" endpoint) + (or (string-suffix-p "followers" endpoint) + (string-suffix-p "following" endpoint)))))) + (defun mastodon-tl--more () "Append older toots to timeline, asynchronously." (interactive) (message "Loading older toots...") - (if (member (buffer-name (current-buffer)) mastodon-tl--link-header-buffers) + (if (mastodon-tl--use-link-header-p) ;; link-header: can't build a URL with --more-json-async, endpoint/id: (let* ((next (car (mastodon-tl--link-header))) ;;(prev (cadr (mastodon-tl--link-header))) @@ -2532,7 +2539,7 @@ from the start if it is nil." "Initialize BUFFER-NAME with timeline targeted by ENDPOINT asynchronously. UPDATE-FUNCTION is used to recieve more toots. HEADERS means to also collect the response headers. Used for paginating -favourites." +favourites and bookmarks." (let ((url (mastodon-http--api endpoint)) (buffer (concat "*mastodon-" buffer-name "*"))) (if headers @@ -2545,8 +2552,8 @@ favourites." "Initialize BUFFER with timeline targeted by ENDPOINT. UPDATE-FUNCTION is used to recieve more toots. RESPONSE is the data returned from the server by -`mastodon-http--process-json', a cons cell of JSON and http -headers." +`mastodon-http--process-json', with arg HEADERS a cons cell of +JSON and http headers, without it just the JSON." (let* ((json (if headers (car response) response)) (headers (if headers (cdr response) nil)) (link-header (mastodon-tl--get-link-header-from-response headers))) -- cgit v1.2.3 From 55c91270734da9e6a11060b3bea7aad152d40680 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 10:09:39 +0100 Subject: readme fill paras --- README.org | 62 ++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/README.org b/README.org index 10627ff..b02db2a 100644 --- a/README.org +++ b/README.org @@ -6,7 +6,8 @@ * README -=mastodon.el= is an Emacs client for the AcitivityPub social networks that implement the Mastodon API. For info see https://joinmastodon.org/. +=mastodon.el= is an Emacs client for the AcitivityPub social networks that +implement the Mastodon API. For info see https://joinmastodon.org/. ** Installation @@ -25,7 +26,8 @@ Or, with =use-package=: :ensure t) #+END_SRC -The minimum Emacs version is now 27.1. But if you are running an older version it shouldn't be very hard to get it working. +The minimum Emacs version is now 27.1. But if you are running an older version +it shouldn't be very hard to get it working. *** MELPA @@ -100,10 +102,10 @@ restart Emacs and follow the steps again. =M-x mastodon= -Opens a =*mastodon-home*= buffer in the major mode and displays toots. If your credentials are not yet saved, you -will be prompted for email and password. The app registration process will -take place if your =mastodon-token-file= does not contain =:client_id= and -=:client_secret=. +Opens a =*mastodon-home*= buffer in the major mode and displays toots. If your +credentials are not yet saved, you will be prompted for email and password. +The app registration process will take place if your =mastodon-token-file= does +not contain =:client_id= and =:client_secret=. **** Keybindings @@ -225,15 +227,19 @@ You can download and use your instance's custom emoji *** Other commands and account settings: -In addition to =mastodon=, the following functions are autoloaded and should work without first loading =mastodon.el=: +In addition to =mastodon=, the following functions are autoloaded and should +work without first loading =mastodon.el=: - =mastodon-toot=: Compose new toot - =mastodon-notifications-get=: View all notifications -- =mastodon-url-lookup=: Attempt to load a URL in =mastodon.el=. URL may be at point or provided in the minibuffer. +- =mastodon-url-lookup=: Attempt to load a URL in =mastodon.el=. URL may be at + point or provided in the minibuffer. -- =mastodon-tl--view-instance-description=: View information about the instance that the author of the toot at point is on. +- =mastodon-tl--view-instance-description=: View information about the instance + that the author of the toot at point is on. - =mastodon-tl--view-own-instance=: View information about your own instance. -- =mastodon-search--trending-tags=: View a list of trending hashtags on your instance. +- =mastodon-search--trending-tags=: View a list of trending hashtags on your + instance. - =mastodon-tl--follow-tag=: Follow a tag (works like following a user) @@ -241,14 +247,21 @@ In addition to =mastodon=, the following functions are autoloaded and should wor - =mastodon-tl--list-followed-tags=: View a list of tags you're following. -- =mastodon-profile--update-display-name=: Update the display name for your account. +- =mastodon-profile--update-display-name=: Update the display name for your + account. - =mastodon-profile--update-user-profile-note=: Update your bio note. - =mastodon-profile--update-meta-fields=: Update your metadata fields. -- =mastodon-profile--set-default-toot-visibility=: Set the default visibility for your toots. -- =mastodon-profile--account-locked-toggle=: Toggle the locked status of your account. Locked accounts have to manually approve follow requests. -- =mastodon-profile--account-discoverable-toggle=: Toggle the discoverable status of your account. Non-discoverable accounts are not listed in the profile directory. -- =mastodon-profile--account-bot-toggle=: Toggle whether your account is flagged as a bot. -- =mastodon-profile--account-sensitive-toggle=: Toggle whether your posts are marked as sensitive (nsfw) by default. +- =mastodon-profile--set-default-toot-visibility=: Set the default visibility + for your toots. +- =mastodon-profile--account-locked-toggle=: Toggle the locked status of your + account. Locked accounts have to manually approve follow requests. +- =mastodon-profile--account-discoverable-toggle=: Toggle the discoverable + status of your account. Non-discoverable accounts are not listed in the + profile directory. +- =mastodon-profile--account-bot-toggle=: Toggle whether your account is flagged + as a bot. +- =mastodon-profile--account-sensitive-toggle=: Toggle whether your posts are + marked as sensitive (nsfw) by default. *** Customization @@ -319,7 +332,9 @@ Optional dependencies: =mastodon.el= should work with ActivityPub servers that implement the Mastodon API. -Apart from Mastodon itself, it is currently known to work with Pleroma and Gotosocial. If you attempt to use =mastodon.el= with another server that implements the Mastodon API and run into problems, feel free to open an issue. +Apart from Mastodon itself, it is currently known to work with Pleroma and +Gotosocial. If you attempt to use =mastodon.el= with another server that +implements the Mastodon API and run into problems, feel free to open an issue. ** Contributing @@ -329,8 +344,12 @@ PRs, issues, feature requests, and general feedback are very welcome! 1. =mastodon.el= has bugs, as well as lots of room for improvement. 2. I receive very little feedback, so if I don't run into the bug it often doesn't get fixed. -3. If you run into something that seems broken, first try running =mastodon.el= in emacs with no init file (i.e. =emacs -q= (instructions and code for doing this are [[https://codeberg.org/martianh/mastodon.el/issues/300][here]]) to see if it also happens independently of your own config (it probably does). -4. Enable debug on error (=toggle-debug-on-error=), make the bug happen again, and copy the backtrace that appears. +3. If you run into something that seems broken, first try running =mastodon.el= + in emacs with no init file (i.e. =emacs -q= (instructions and code for doing + this are [[https://codeberg.org/martianh/mastodon.el/issues/300][here]]) to see if it also happens independently of your own config + (it probably does). +4. Enable debug on error (=toggle-debug-on-error=), make the bug happen again, + and copy the backtrace that appears. 5. Open an issue here and explain what is going on. *** Features @@ -349,7 +368,10 @@ PRs, issues, feature requests, and general feedback are very welcome! ** Supporting mastodon.el -If you'd like to support continued development of =mastodon.el=, I accept donations via paypal at martianhiatus [ at ] riseup [ dot ] net. If you would prefer a different payment method, write to me at that address and I can provide IBAN or other details. +If you'd like to support continued development of =mastodon.el=, I accept +donations via paypal at martianhiatus [ at ] riseup [ dot ] net. If you would +prefer a different payment method, write to me at that address and I can +provide IBAN or other details. I don't have a tech worker's income, so even a small tip would help out. -- cgit v1.2.3 From 14b7547c385648565eba8a4bac3dc8afa5ebf978 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 10:44:45 +0100 Subject: use homegrown icons in tl--symbols list --- lisp/mastodon-tl.el | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 1a26a54..7477b25 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -106,30 +106,22 @@ width fonts when rendering HTML text")) :group 'mastodon-tl :type '(boolean :tag "Whether to display user avatars in timelines")) -;; Various symbols using throughout timeline -;; Default comes from nerd-font (www.nerdfonts.com) -(defcustom mastodon-tl-symbols - '(;; See https://icon-sets.iconify.design/octicon/comment-24/ - (reply . ("" . "R")) - ;; See https://icon-sets.iconify.design/octicon/reply-24/ - (boost . ("" . "B")) - ;; See https://icon-sets.iconify.design/octicon/star-fill-24/ - (favourite . ("" . "F")) - ;; See https://icon-sets.iconify.design/octicon/bookmark-24/ - (bookmark . ("" . "K")) - ;; See https://icon-sets.iconify.design/octicon/file-media-24/ - (media . ("" . "M")) - ;; See https://icon-sets.iconify.design/octicon/verified-24/ - (verified . ("" . "V")) - ;; See https://icon-sets.iconify.design/octicon/person-fill-24/ - (private . ("" . "P")) - ;; See https://icon-sets.iconify.design/octicon/location-24/ - (direct . ("" . "D"))) - "Set of symbols (or strings) to be used in timeline. If a symbol does not look right (tofu), it means your font settings do not support it." +(defcustom mastodon-tl--symbols + '((reply . ("💬" . "R")) + (boost . ("🔁" . "B")) + (favourite . ("⭐" . "F")) + (bookmark . ("🔖" . "K")) + (media . ("" . "M")) + (verified . ("" . "V")) + (private . ("🔒" . "P")) + (direct . ("✉" . "D")) + (edited . ("✍" . "E"))) + "A set of symbols (and fallback strings) to be used in timeline. +If a symbol does not look right (tofu), it means your +font settings do not support it." :type '(alist :key-type symbol :value-type string) :group 'mastodon-tl) - (defvar-local mastodon-tl--update-point nil "When updating a mastodon buffer this is where new toots will be inserted. @@ -226,14 +218,12 @@ It is active where point is placed by `mastodon-tl--goto-next-toot.'") (defun mastodon-tl--symbol (name) "Return the unicode symbol (as a string) corresponding to NAME. - If symbol is not displayable, an ASCII equivalent is returned. If NAME is not part of the symbol table, '?' is returned." - - (if-let* ((symbol (alist-get name mastodon-tl-symbols))) - (if (char-displayable-p (string-to-char (car symbol))) - (car symbol) - (cdr symbol)) + (if-let* ((symbol (alist-get name mastodon-tl--symbols))) + (if (char-displayable-p (string-to-char (car symbol))) + (car symbol) + (cdr symbol)) "?")) -- cgit v1.2.3 From 8448f28c129662625e5c4beb98592fb9ef06032a Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 10:58:14 +0100 Subject: cleanup --symbols, autoload --- lisp/mastodon-profile.el | 5 ++--- lisp/mastodon-tl.el | 38 +++++++------------------------------- 2 files changed, 9 insertions(+), 34 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 658b1d4..c275e5c 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -74,6 +74,7 @@ (autoload 'mastodon-http--get-response "mastodon-http") (autoload 'mastodon-tl--get-link-header-from-response "mastodon-tl") (autoload 'mastodon-tl--set-buffer-spec "mastodon-tl") +(autoload 'mastodon-tl--symbol "mastodon-tl") (defvar mastodon-instance-url) (defvar mastodon-tl--buffer-spec) @@ -628,9 +629,7 @@ HEADERS means also fetch link headers for pagination." (propertize (concat "@" acct) 'face 'default) (if (equal locked t) - (if (fontp (char-displayable-p #10r9993)) - " 🔒" - " [locked]") + (mastodon-tl--symbol 'locked) "") "\n ------------\n" ;; profile note: diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 1a5fc33..8c9e00a 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -129,9 +129,10 @@ nil." (bookmark . ("🔖" . "K")) (media . ("" . "M")) (verified . ("" . "V")) - (private . ("🔒" . "P")) - (direct . ("✉" . "D")) - (edited . ("✍" . "E"))) + (locked . ("🔒" . "[locked]")) + (private . ("🔒" . "[followers]")) + (direct . ("✉" . "[direct]")) + (edited . ("✍" . "[edited]"))) "A set of symbols (and fallback strings) to be used in timeline. If a symbol does not look right (tofu), it means your font settings do not support it." @@ -629,7 +630,6 @@ this just means displaying toot client." (faved (equal 't (mastodon-tl--field 'favourited toot))) (boosted (equal 't (mastodon-tl--field 'reblogged toot))) (bookmarked (equal 't (mastodon-tl--field 'bookmarked toot))) - (bookmark-str (mastodon-tl--symbol 'bookmark)) (visibility (mastodon-tl--field 'visibility toot)) (account (alist-get 'account toot)) (avatar-url (alist-get 'avatar account)) @@ -645,13 +645,13 @@ this just means displaying toot client." ;; the toot having just been favourited/boosted. (concat (when boosted (mastodon-tl--format-faved-or-boosted-byline - (mastodon-tl--return-boost-char))) + (mastodon-tl--symbol 'boost))) (when faved (mastodon-tl--format-faved-or-boosted-byline - (mastodon-tl--return-fave-char))) + (mastodon-tl--symbol 'favourite))) (when bookmarked (mastodon-tl--format-faved-or-boosted-byline - (mastodon-tl--return-bookmark-char)))) + (mastodon-tl--symbol 'bookmark)))) ;; we remove avatars from the byline also, so that they also do not mess ;; with `mastodon-tl--goto-next-toot': (when (and mastodon-tl--show-avatars @@ -718,30 +718,6 @@ this just means displaying toot client." (mastodon-toot--get-toot-edits (alist-get 'id toot))) 'byline t)))) -(defun mastodon-tl--return-boost-char () - "" - (cond - ((fontp (char-displayable-p #10r128257)) - "🔁") - (t - "B"))) - -(defun mastodon-tl--return-fave-char () - "" - (cond - ((fontp (char-displayable-p #10r11088)) - "⭐") - ((fontp (char-displayable-p #10r9733)) - "★") - (t - "F"))) - -(defun mastodon-tl--return-bookmark-char () - "" - (if (fontp (char-displayable-p #10r128278)) - "🔖" - "K")) - (defun mastodon-tl--format-edit-timestamp (timestamp) "Convert edit TIMESTAMP into a descriptive string." (let ((parsed (ts-human-duration -- cgit v1.2.3 From e463727b4b77ac8cae8c3c3b0d41dd25eab15a85 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 11:04:13 +0100 Subject: fix byline-favourited and byline-boosted tests --- test/mastodon-tl-tests.el | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el index a80c3ee..4286975 100644 --- a/test/mastodon-tl-tests.el +++ b/test/mastodon-tl-tests.el @@ -348,14 +348,15 @@ Strict-Transport-Security: max-age=31536000 (toot (cons '(reblogged . t) mastodon-tl-test-base-toot)) (timestamp (cdr (assoc 'created_at toot)))) (with-mock - (mock (date-to-time timestamp) => '(22782 21551)) - (mock (format-time-string mastodon-toot-timestamp-format '(22782 21551)) => "2999-99-99 00:11:22") - - (should (string= (substring-no-properties - (mastodon-tl--byline toot - 'mastodon-tl--byline-author - 'mastodon-tl--byline-boosted)) - "(B) Account 42 (@acct42@example.space) 2999-99-99 00:11:22 + (mock (date-to-time timestamp) => '(22782 21551)) + (mock (mastodon-tl--symbol 'boost) => "B") + (mock (format-time-string mastodon-toot-timestamp-format '(22782 21551)) => "2999-99-99 00:11:22") + + (should (string= (substring-no-properties + (mastodon-tl--byline toot + 'mastodon-tl--byline-author + 'mastodon-tl--byline-boosted)) + "(B) Account 42 (@acct42@example.space) 2999-99-99 00:11:22 ------------ "))))) @@ -365,14 +366,15 @@ Strict-Transport-Security: max-age=31536000 (toot (cons '(favourited . t) mastodon-tl-test-base-toot)) (timestamp (cdr (assoc 'created_at toot)))) (with-mock - (mock (date-to-time timestamp) => '(22782 21551)) - (mock (format-time-string mastodon-toot-timestamp-format '(22782 21551)) => "2999-99-99 00:11:22") - - (should (string= (substring-no-properties - (mastodon-tl--byline toot - 'mastodon-tl--byline-author - 'mastodon-tl--byline-boosted)) - "(F) Account 42 (@acct42@example.space) 2999-99-99 00:11:22 + (mock (mastodon-tl--symbol 'favourite) => "F") + (mock (date-to-time timestamp) => '(22782 21551)) + (mock (format-time-string mastodon-toot-timestamp-format '(22782 21551)) => "2999-99-99 00:11:22") + + (should (string= (substring-no-properties + (mastodon-tl--byline toot + 'mastodon-tl--byline-author + 'mastodon-tl--byline-boosted)) + "(F) Account 42 (@acct42@example.space) 2999-99-99 00:11:22 ------------ "))))) -- cgit v1.2.3 From 5d5d4078f3f307e3fd5f020cbee53e9a3f9197c1 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 11:14:16 +0100 Subject: hack to fix other byline tests --- test/mastodon-tl-tests.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el index 4286975..d32863b 100644 --- a/test/mastodon-tl-tests.el +++ b/test/mastodon-tl-tests.el @@ -386,13 +386,17 @@ Strict-Transport-Security: max-age=31536000 (timestamp (cdr (assoc 'created_at toot)))) (with-mock (mock (date-to-time timestamp) => '(22782 21551)) + ;; FIXME this mock refuses to recognise our different args + ;; (mock (mastodon-tl--symbol 'favourite) => "F") + ;; (mock (mastodon-tl--symbol 'boost) => "B") + (mock (mastodon-tl--symbol *) => "?") (mock (format-time-string mastodon-toot-timestamp-format '(22782 21551)) => "2999-99-99 00:11:22") (should (string= (substring-no-properties (mastodon-tl--byline toot 'mastodon-tl--byline-author 'mastodon-tl--byline-boosted)) - "(B) (F) Account 42 (@acct42@example.space) 2999-99-99 00:11:22 + "(?) (?) Account 42 (@acct42@example.space) 2999-99-99 00:11:22 ------------ "))))) @@ -466,6 +470,10 @@ Strict-Transport-Security: max-age=31536000 ;; We don't expect to use the toot's timestamp but the timestamp of the ;; reblogged toot: (mock (date-to-time timestamp) => '(1 2)) + ;; FIXME this mock refuses to recognise our different args + ;; (mock (mastodon-tl--symbol 'favourite) => "F") + ;; (mock (mastodon-tl--symbol 'boost) => "B") + (mock (mastodon-tl--symbol *) => "?") (mock (format-time-string mastodon-toot-timestamp-format '(1 2)) => "reblogging time") (mock (date-to-time original-timestamp) => '(3 4)) (mock (format-time-string mastodon-toot-timestamp-format '(3 4)) => "original time") @@ -474,7 +482,7 @@ Strict-Transport-Security: max-age=31536000 (mastodon-tl--byline toot 'mastodon-tl--byline-author 'mastodon-tl--byline-boosted)) - "(B) (F) Account 42 (@acct42@example.space) + "(?) (?) Account 42 (@acct42@example.space) Boosted Account 43 (@acct43@example.space) original time ------------ "))))) -- cgit v1.2.3 From 217af69c12d4472d308e2aec6cdd78045d70d97b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 11:22:10 +0100 Subject: symbols: preceding space for locked accounts, private/direct toots --- lisp/mastodon-profile.el | 2 +- lisp/mastodon-tl.el | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index c275e5c..54f0e84 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -629,7 +629,7 @@ HEADERS means also fetch link headers for pagination." (propertize (concat "@" acct) 'face 'default) (if (equal locked t) - (mastodon-tl--symbol 'locked) + (concat " " (mastodon-tl--symbol 'locked)) "") "\n ------------\n" ;; profile note: diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 8c9e00a..aa34c2e 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -667,9 +667,9 @@ this just means displaying toot client." (funcall author-byline toot) ;; visibility: (cond ((equal visibility "direct") - (mastodon-tl--symbol 'direct)) + (concat " " (mastodon-tl--symbol 'direct))) ((equal visibility "private") - (mastodon-tl--symbol 'private))) + (concat " " (mastodon-tl--symbol 'private)))) (funcall action-byline toot) " " ;; TODO: Once we have a view for toot (responses etc.) make -- cgit v1.2.3 From 0bee7050dd608c33b599434e17ce9229ce8ea3a0 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 11:31:20 +0100 Subject: always use mastodon-tl--symbol --- lisp/mastodon-tl.el | 6 +++--- lisp/mastodon-toot.el | 38 ++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index aa34c2e..fc3dc2e 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -697,9 +697,9 @@ this just means displaying toot client." 'keymap mastodon-tl--shr-map-replacement))))) (if edited-time (concat - (if (fontp (char-displayable-p #10r128274)) - " ✍ " - " [edited] ") + " " + (mastodon-tl--symbol 'edited) + " " (propertize (format-time-string mastodon-toot-timestamp-format edited-parsed) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 27e7ce5..c99f088 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -78,7 +78,7 @@ (autoload 'mastodon-http--build-array-params-alist "mastodon-http") (autoload 'mastodon-tl--get-endpoint "mastodon-tl") (autoload 'mastodon-http--put "mastodon-http") -(autoload 'mastodon-tl--return-fave-char "mastodon-tl") +(autoload 'mastodon-tl--symbol "mastodon-tl") ;; for mastodon-toot--translate-toot-text (autoload 'mastodon-tl--content "mastodon-tl") @@ -345,8 +345,8 @@ TYPE is a symbol, either 'favourite or 'boost." (list 'favourited-p (not faved)))) (mastodon-toot--action-success (if boost-p - (mastodon-tl--return-boost-char) - (mastodon-tl--return-fave-char)) + (mastodon-tl--symbol 'boost) + (mastodon-tl--symbol 'favourite)) byline-region remove)) (message (format "%s #%s" (if boost-p msg action) id)))))) (message (format "Nothing to %s here?!?" action-string))))) @@ -366,23 +366,21 @@ TYPE is a symbol, either 'favourite or 'boost." "Bookmark or unbookmark toot at point." (interactive) (let* ( ;(toot (mastodon-tl--property 'toot-json)) - (id (mastodon-tl--property 'base-toot-id)) - ;; (mastodon-tl--as-string (mastodon-tl--toot-id toot))) - (bookmarked-p (mastodon-tl--property 'bookmarked-p)) - (prompt (if bookmarked-p - (format "Toot already bookmarked. Remove? ") - (format "Bookmark this toot? "))) - (byline-region - (when id - (mastodon-tl--find-property-range 'byline (point)))) - (action (if bookmarked-p "unbookmark" "bookmark")) - (bookmark-str (if (fontp (char-displayable-p #10r128278)) - "🔖" - "K")) - (message (if bookmarked-p - "Bookmark removed!" - "Toot bookmarked!")) - (remove (when bookmarked-p t))) + (id (mastodon-tl--property 'base-toot-id)) + ;; (mastodon-tl--as-string (mastodon-tl--toot-id toot))) + (bookmarked-p (mastodon-tl--property 'bookmarked-p)) + (prompt (if bookmarked-p + (format "Toot already bookmarked. Remove? ") + (format "Bookmark this toot? "))) + (byline-region + (when id + (mastodon-tl--find-property-range 'byline (point)))) + (action (if bookmarked-p "unbookmark" "bookmark")) + (bookmark-str (mastodon-tl--symbol 'bookmark)) + (message (if bookmarked-p + "Bookmark removed!" + "Toot bookmarked!")) + (remove (when bookmarked-p t))) (if byline-region (when (y-or-n-p prompt) (mastodon-toot--action -- cgit v1.2.3 From 8ee5b29c10a128b8268ddac82c96154d9b0208c1 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 11:52:25 +0100 Subject: tl--symbol -- add media icon --- lisp/mastodon-tl.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index fc3dc2e..ce2062d 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -127,7 +127,7 @@ nil." (boost . ("🔁" . "B")) (favourite . ("⭐" . "F")) (bookmark . ("🔖" . "K")) - (media . ("" . "M")) + (media . ("📹" . "[media]")) (verified . ("" . "V")) (locked . ("🔒" . "[locked]")) (private . ("🔒" . "[followers]")) -- cgit v1.2.3 From ae8f6c6d7dfdd8048c8bab21b3afd81f981fbc96 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 14:51:45 +0100 Subject: always use --set-buffer-spec, not setq --buffer-spec --- lisp/mastodon-async.el | 13 +++++-------- lisp/mastodon-search.el | 19 ++++++++----------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/lisp/mastodon-async.el b/lisp/mastodon-async.el index 8a08416..58e7b93 100644 --- a/lisp/mastodon-async.el +++ b/lisp/mastodon-async.el @@ -229,14 +229,11 @@ ENDPOINT is the endpoint for the stream and timeline." (mastodon-tl--timeline (mastodon-http--get-json (mastodon-http--api endpoint)))) (mastodon-mode) - (setq mastodon-tl--buffer-spec - `(buffer-name - ,buffer-name - endpoint ,endpoint - update-function - ,(if (equal name "notifications") - 'mastodon-notifications--timeline - 'mastodon-tl--timeline))) + (mastodon-tl--set-buffer-spec buffer-name + endpoint + ,(if (equal name "notifications") + 'mastodon-notifications--timeline + 'mastodon-tl--timeline)) (setq-local mastodon-tl--enable-relative-timestamps nil) (setq-local mastodon-tl--display-media-p t) (current-buffer)))) diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index 65c5aba..4aa5721 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -40,12 +40,13 @@ (autoload 'mastodon-auth--access-token "mastodon-auth") (autoload 'mastodon-http--get-search-json "mastodon-http") (autoload 'mastodon-http--api "mastodon-http") +(autoload 'mastodon-tl--set-buffer-spec "mastodon-tl") + (defvar mastodon-toot--completion-style-for-mentions) (defvar mastodon-instance-url) (defvar mastodon-tl--link-keymap) (defvar mastodon-http--timeout) (defvar mastodon-toot--enable-completion-for-mentions) -(defvar mastodon-tl--buffer-spec) ;; functions for completion of mentions in mastodon-toot @@ -101,11 +102,9 @@ QUERY is the string to search." (mastodon-mode) (let ((inhibit-read-only t)) (erase-buffer) - (setq mastodon-tl--buffer-spec - `(buffer-name ,buffer - endpoint ,(format "api/v1/trends") - update-function - (lambda (toot) (message "Trends.")))) + (mastodon-tl--set-buffer-spec buffer + "api/v1/trends" + nil) ;; hashtag results: (insert (mastodon-tl--set-face (concat "\n ------------\n" @@ -141,11 +140,9 @@ QUERY is the string to search." (mastodon-mode) (let ((inhibit-read-only t)) (erase-buffer) - (setq mastodon-tl--buffer-spec - `(buffer-name ,buffer - endpoint ,(format "api/v2/search") - update-function - (lambda (toot) (message "Searched.")))) + (mastodon-tl--set-buffer-spec buffer + "api/v2/search" + nil) ;; user results: (insert (mastodon-tl--set-face (concat "\n ------------\n" -- cgit v1.2.3 From c6281d6579cdcae5d2e1200a35b4f09a4406496e Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 15:08:32 +0100 Subject: remove --view-author-profile, replace with --get-toot-author --- lisp/mastodon-profile.el | 8 -------- lisp/mastodon-tl.el | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 54f0e84..91103f1 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -737,14 +737,6 @@ IMG_TYPE is the JSON key from the account data." (message "Loading your profile...") (mastodon-profile--show-user (mastodon-auth--get-account-name))) -(defun mastodon-profile--view-author-profile () - "View the profile of author of present toot." - (interactive) - (let* ((toot-json (mastodon-tl--property 'toot-json)) - (acct (alist-get 'account toot-json)) - (handle (alist-get 'acct acct))) - (mastodon-profile--show-user handle))) - (defun mastodon-profile--account-field (account field) "Return FIELD from the ACCOUNT. FIELD is used to identify regions under 'account" diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index ce2062d..dccf36a 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -254,7 +254,7 @@ types of mastodon links and not just shr.el-generated ones.") (when (require 'mpv nil :no-error) (let ((map (make-sparse-keymap))) (define-key map (kbd "") 'mastodon-tl--mpv-play-video-from-byline) - (define-key map (kbd "") 'mastodon-profile--view-author-profile) + (define-key map (kbd "") 'mastodon-profile--get-toot-author) (keymap-canonicalize map))) "The keymap to be set for the author byline. It is active where point is placed by `mastodon-tl--goto-next-toot.'") -- cgit v1.2.3 From 8c3f5435b977c04edbe86015ecdf7f9ba181e80e Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 15:20:02 +0100 Subject: --set-buffer-spec everywhere(?) and include handle/instance url set buffer spec in view instances description --- lisp/mastodon-profile.el | 9 ++++++++- lisp/mastodon-tl.el | 13 +++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 91103f1..6dbe572 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -287,7 +287,8 @@ JSON is the data returned by the server." (defun mastodon-profile--update-user-profile-note () "Fetch user's profile note and display for editing." (interactive) - (let* ((url (mastodon-http--api "accounts/verify_credentials")) + (let* ((endpoint "accounts/verify_credentials") + (url (mastodon-http--api endpoint)) (json (mastodon-http--get-json url)) (source (alist-get 'source json)) (note (alist-get 'note source)) @@ -295,6 +296,9 @@ JSON is the data returned by the server." (inhibit-read-only t)) (switch-to-buffer-other-window buffer) (text-mode) + (mastodon-tl--set-buffer-spec (buffer-name buffer) + endpoint + nil) (setq-local header-line-format (propertize "Edit your profile note. C-c C-c to send, C-c C-k to cancel." @@ -497,6 +501,9 @@ This endpoint only holds a few preferences. For others, see (switch-to-buffer-other-window buf) (erase-buffer) (special-mode) + (mastodon-tl--set-buffer-spec (buffer-name buf) + "preferences" + nil) (let ((inhibit-read-only t)) (while response (let ((el (pop response))) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index dccf36a..b019272 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1368,10 +1368,12 @@ BUFFER is buffer name, ENDPOINT is buffer's enpoint, UPDATE-FUNCTION is its update function. LINK-HEADER is the http Link header if present." (setq mastodon-tl--buffer-spec - `(buffer-name ,buffer - endpoint ,endpoint - update-function ,update-function - link-header ,link-header))) + `(account ,(cons mastodon-active-user + mastodon-instance-url) + buffer-name ,buffer + endpoint ,endpoint + update-function ,update-function + link-header ,link-header))) (defun mastodon-tl--more-json (endpoint id) "Return JSON for timeline ENDPOINT before ID." @@ -1951,6 +1953,9 @@ INSTANCE is an instance domain name." (let ((buf (get-buffer-create "*mastodon-instance*"))) (with-current-buffer buf (switch-to-buffer-other-window buf) + (mastodon-tl--set-buffer-spec (buffer-name buf) + "instance" + nil) (let ((inhibit-read-only t)) (erase-buffer) (special-mode) -- cgit v1.2.3 From 75896755e97a75523eb9e4a8aef3d30350c30299 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 15:31:38 +0100 Subject: no lambdas allowed in buffer-spec update-function! --- lisp/mastodon-profile.el | 1 - lisp/mastodon-tl.el | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 6dbe572..1200972 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -584,7 +584,6 @@ HEADERS means also fetch link headers for pagination." (link-header (when headers (mastodon-tl--get-link-header-from-response (cdr response)))) - (note (mastodon-profile--account-field account 'note)) (locked (mastodon-profile--account-field account 'locked)) (followers-count (mastodon-tl--as-string diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index b019272..f02593c 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1453,7 +1453,7 @@ ID is that of the toot to view." (mastodon-mode) (mastodon-tl--set-buffer-spec buffer (format "statuses/%s" id) - (lambda (_toot) (message "END of thread."))) + nil) (let ((inhibit-read-only t)) (mastodon-tl--toot toot :detailed-p)))))) @@ -1493,7 +1493,7 @@ ID is that of the toot to view." (mastodon-tl--set-buffer-spec buffer (format "statuses/%s/context" id) - (lambda (_toot) (message "END of thread."))) + 'mastodon-tl--thread) (let ((inhibit-read-only t)) (mastodon-tl--timeline (alist-get 'ancestors context)) (goto-char (point-max)) -- cgit v1.2.3 From 2dee7f3fb663d2626fdbb028839c099a11932cba Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 16:16:57 +0100 Subject: fix do user fun test in tl --- test/mastodon-tl-tests.el | 90 +++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el index a80c3ee..ee0f632 100644 --- a/test/mastodon-tl-tests.el +++ b/test/mastodon-tl-tests.el @@ -1050,53 +1050,53 @@ correct value for following, as well as notifications enabled or disabled." (let ((response-buffer-true (current-buffer))) (insert mastodon-tl--follow-notify-true-response) (with-mock - (mock (mastodon-http--post url-follow-only) - => response-buffer-true) - (should - (equal - (mastodon-tl--do-user-action-function url-follow-only - user-name - user-handle - "follow") - "User some-user (@some-user@instance.url) followed!")) - (mock (mastodon-http--post url-mute) - => response-buffer-true) - (should - (equal - (mastodon-tl--do-user-action-function url-mute - user-name - user-handle - "mute") - "User some-user (@some-user@instance.url) muted!")) - (mock (mastodon-http--post url-block) - => response-buffer-true) - (should - (equal - (mastodon-tl--do-user-action-function url-block - user-name - user-handle - "block") - "User some-user (@some-user@instance.url) blocked!"))) + (mock (mastodon-http--post url-follow-only nil) + => response-buffer-true) + (should + (equal + (mastodon-tl--do-user-action-function url-follow-only + user-name + user-handle + "follow") + "User some-user (@some-user@instance.url) followed!")) + (mock (mastodon-http--post url-mute nil) + => response-buffer-true) + (should + (equal + (mastodon-tl--do-user-action-function url-mute + user-name + user-handle + "mute") + "User some-user (@some-user@instance.url) muted!")) + (mock (mastodon-http--post url-block nil) + => response-buffer-true) + (should + (equal + (mastodon-tl--do-user-action-function url-block + user-name + user-handle + "block") + "User some-user (@some-user@instance.url) blocked!"))) (with-mock - (mock (mastodon-http--post url-true) => response-buffer-true) - (should - (equal - (mastodon-tl--do-user-action-function url-true - user-name - user-handle - "follow" - "true") - "Receiving notifications for user some-user (@some-user@instance.url)!"))))) + (mock (mastodon-http--post url-true nil) => response-buffer-true) + (should + (equal + (mastodon-tl--do-user-action-function url-true + user-name + user-handle + "follow" + "true") + "Receiving notifications for user some-user (@some-user@instance.url)!"))))) (with-temp-buffer (let ((response-buffer-false (current-buffer))) (insert mastodon-tl--follow-notify-false-response) (with-mock - (mock (mastodon-http--post url-false) => response-buffer-false) - (should - (equal - (mastodon-tl--do-user-action-function url-false - user-name - user-handle - "follow" - "false") - "Not receiving notifications for user some-user (@some-user@instance.url)!"))))))) + (mock (mastodon-http--post url-false nil) => response-buffer-false) + (should + (equal + (mastodon-tl--do-user-action-function url-false + user-name + user-handle + "follow" + "false") + "Not receiving notifications for user some-user (@some-user@instance.url)!"))))))) -- cgit v1.2.3 From fc003dced37165fdf36223461216304ae4d0b420 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 16:18:48 +0100 Subject: docstring --- lisp/mastodon-tl.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index dd3ce1b..3b9a8c6 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2109,7 +2109,9 @@ LANGS is an array parameters alist of languages to filer user's posts by." (mastodon-tl--follow-user user-handle "false")) (defun mastodon-tl--filter-user-user-posts-by-language (user-handle) - "Query for USER-HANDLE and enable notifications when they post." + "Query for USER-HANDLE and enable notifications when they post. +This feature is experimental and for now not easily varified by +the instance API." (interactive (list (mastodon-tl--interactive-user-handles-get "filter by language"))) -- cgit v1.2.3 From 1f4870555241fcc55f6f2c2e2f6f64993ec2c3ad Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 16:33:07 +0100 Subject: remove stray company funs in search.el --- lisp/mastodon-search.el | 14 +++----------- lisp/mastodon-toot.el | 3 +-- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index 4aa5721..1aed676 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -50,19 +50,13 @@ ;; functions for completion of mentions in mastodon-toot -(defun mastodon-search--get-user-info-@-capf (account) +(defun mastodon-search--get-user-info-@ (account) "Get user handle, display name and account URL from ACCOUNT." (list (concat "@" (cdr (assoc 'acct account))) (cdr (assoc 'url account)) (cdr (assoc 'display_name account)))) -(defun mastodon-search--get-user-info-@ (account) - "Get user handle, display name and account URL from ACCOUNT." - (list (cdr (assoc 'display_name account)) - (concat "@" (cdr (assoc 'acct account))) - (cdr (assoc 'url account)))) - -(defun mastodon-search--search-accounts-query (query &optional capf) +(defun mastodon-search--search-accounts-query (query) "Prompt for a search QUERY and return accounts synchronously. Returns a nested list containing user handle, display name, and URL." (interactive "sSearch mastodon for: ") @@ -70,9 +64,7 @@ Returns a nested list containing user handle, display name, and URL." (response (if (equal mastodon-toot--completion-style-for-mentions "following") (mastodon-http--get-json url `(("q" . ,query) ("following" . "true")) :silent) (mastodon-http--get-json url `(("q" . ,query)) :silent)))) - (if capf - (mapcar #'mastodon-search--get-user-info-@-capf response) - (mapcar #'mastodon-search--get-user-info-@ response)))) + (mapcar #'mastodon-search--get-user-info-@ response))) ;; functions for tags completion: diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 688717d..099ce10 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -853,8 +853,7 @@ eg. \"feduser@fed.social\" -> \"feduser@fed.social\"." ;; just for the annotation-function? (setq mastodon-toot-completions (mastodon-search--search-accounts-query - (buffer-substring-no-properties start end) - :capf)))) + (buffer-substring-no-properties start end))))) :exclusive 'no :annotation-function (lambda (candidate) -- cgit v1.2.3 From f08fe8278c368795bc5a8f19d1d44a5142c7350c Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 16:43:21 +0100 Subject: fix search.el test --- test/mastodon-search-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mastodon-search-tests.el b/test/mastodon-search-tests.el index e6d4cdb..8dc597a 100644 --- a/test/mastodon-search-tests.el +++ b/test/mastodon-search-tests.el @@ -119,7 +119,7 @@ (should (equal (mastodon-search--get-user-info-@ mastodon-search--single-account-query) - '(": ( ) { : | : & } ; :" "@mousebot" "https://todon.nl/@mousebot")))) + '("@mousebot" "https://todon.nl/@mousebot" ": ( ) { : | : & } ; :")))) (ert-deftest mastodon-search--get-user-info () "Should build a list from a single account for company completion." -- cgit v1.2.3 From 21bb3bff54c766514b93d8022f149f4179e9d31e Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 26 Nov 2022 18:20:01 +0100 Subject: nil the update-fun in buffer-spec for --thread views --- lisp/mastodon-tl.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 7d23b69..a5b5ed7 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1491,10 +1491,9 @@ ID is that of the toot to view." (with-output-to-temp-buffer buffer (switch-to-buffer buffer) (mastodon-mode) - (mastodon-tl--set-buffer-spec - buffer - (format "statuses/%s/context" id) - 'mastodon-tl--thread) + (mastodon-tl--set-buffer-spec buffer + (format "statuses/%s/context" id) + nil) (let ((inhibit-read-only t)) (mastodon-tl--timeline (alist-get 'ancestors context)) (goto-char (point-max)) -- cgit v1.2.3 From e23ef05fabe038396875c118101847d69e5de7f6 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 27 Nov 2022 10:35:07 +0100 Subject: add fun mastodon-tl--dm-user --- lisp/mastodon-tl.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index a5b5ed7..53ab57a 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2175,6 +2175,16 @@ LANGS is the accumulated array param alist if we re-run recursively." (message "Looks like you have no mutes to unmute!") (mastodon-tl--do-user-action-and-response user-handle "unmute" t))) +(defun mastodon-tl--dm-user (user-handle) + "Query for USER-HANDLE from current status and compose a message to that user." + (interactive + (list + (mastodon-tl--interactive-user-handles-get "message"))) + (mastodon-tl--do-if-toot + (mastodon-toot--compose-buffer (concat "@" user-handle)) + (setq mastodon-toot--visibility "direct") + (mastodon-toot--update-status-fields))) + (defun mastodon-tl--interactive-user-handles-get (action) "Get the list of user-handles for ACTION from the current toot." (mastodon-tl--do-if-toot -- cgit v1.2.3 From 3b3e97c0c142e41be1acb419b5793b8aa62b0920 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 27 Nov 2022 11:33:14 +0100 Subject: extract endpoint to let var in --thread --- lisp/mastodon-tl.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 53ab57a..49c26ea 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1469,7 +1469,8 @@ ID is that of the toot to view." (if (or (string= type "follow_request") (string= type "follow")) ; no can thread these (error "No thread") - (let* ((url (mastodon-http--api (format "statuses/%s/context" id))) + (let* ((endpoint (format "statuses/%s/context" id)) + (url (mastodon-http--api endpoint)) (buffer (format "*mastodon-thread-%s*" id)) (toot ;; refetch current toot in case we just faved/boosted: @@ -1492,7 +1493,7 @@ ID is that of the toot to view." (switch-to-buffer buffer) (mastodon-mode) (mastodon-tl--set-buffer-spec buffer - (format "statuses/%s/context" id) + endpoint nil) (let ((inhibit-read-only t)) (mastodon-tl--timeline (alist-get 'ancestors context)) -- cgit v1.2.3 From accc0c8b451580169300d28974c62650e5e30aac Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 27 Nov 2022 11:34:43 +0100 Subject: add tl--mute-thread --- lisp/mastodon-tl.el | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 49c26ea..fe865d0 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1508,6 +1508,46 @@ ID is that of the toot to view." ;; else just print the lone toot: (mastodon-tl--single-toot id))))))) + +(defun mastodon-tl--mute-thread () + "Mute the thread displayed in the current buffer." + (interactive) + (let ((endpoint (mastodon-tl--get-endpoint))) + (if (string-suffix-p "context" endpoint) ; thread view + (let* ((id + (save-match-data + (let ((str (string-match "statuses/\\(?2:[[:digit:]]+\\)/context" + endpoint))) + (match-string 2 endpoint)))) + (we-posted-p (mastodon-tl--user-in-thread-p id)) + (url (mastodon-http--api (format "statuses/%s/mute" id)))) + (if (not we-posted-p) + (message "You can only mute a thread you have posted in.") + (when (y-or-n-p "Mute this thread? ") + (let ((response (mastodon-http--post url))) + (mastodon-http--triage response + (lambda () + (message "Thread muted!")))))))))) + +(defun mastodon-tl--user-in-thread-p (id) + "Return non-nil if the logged-in user has posted to the current thread. +ID is that of the post the context is currently displayed for." + (let* ((context-json (mastodon-http--get-json + (mastodon-http--api (format "statuses/%s/context" id)) + nil :silent)) + (ancestors (alist-get 'ancestors context-json)) + (descendants (alist-get 'descendants context-json)) + (a-ids (mapcar (lambda (status) + (alist-get 'id + (alist-get 'account status))) + ancestors)) + (d-ids (mapcar (lambda (status) + (alist-get 'id + (alist-get 'account status))) + descendants))) + (or (member (mastodon-auth--get-account-id) a-ids) + (member (mastodon-auth--get-account-id) d-ids)))) + ;;; LISTS (defun mastodon-tl--get-users-lists () -- cgit v1.2.3 From fa82691cc42a4344015a4920ee0582a92897160b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 27 Nov 2022 11:44:34 +0100 Subject: unmute or mute a thread --- lisp/mastodon-tl.el | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index fe865d0..fbf1b7b 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1510,8 +1510,20 @@ ID is that of the toot to view." (defun mastodon-tl--mute-thread () - "Mute the thread displayed in the current buffer." + "Mute the thread displayed in the current buffer. +Note that you can only (un)mute threads you have posted in." (interactive) + (mastodon-tl--mute-or-unmute-thread)) + +(defun mastodon-tl--unmute-thread () + "Mute the thread displayed in the current buffer. +Note that you can only (un)mute threads you have posted in." + (interactive) + (mastodon-tl--mute-or-unmute-thread :unmute)) + +(defun mastodon-tl--mute-or-unmute-thread (&optional unmute) + "Mute a thread. +If UNMUTE, unmute it." (let ((endpoint (mastodon-tl--get-endpoint))) (if (string-suffix-p "context" endpoint) ; thread view (let* ((id @@ -1520,14 +1532,21 @@ ID is that of the toot to view." endpoint))) (match-string 2 endpoint)))) (we-posted-p (mastodon-tl--user-in-thread-p id)) - (url (mastodon-http--api (format "statuses/%s/mute" id)))) + (url (mastodon-http--api + (if unmute + (format "statuses/%s/unmute" id) + (format "statuses/%s/mute" id))))) (if (not we-posted-p) - (message "You can only mute a thread you have posted in.") - (when (y-or-n-p "Mute this thread? ") + (message "You can only (un)mute a thread you have posted in.") + (when (if unmute + (y-or-n-p "Unute this thread? ") + (y-or-n-p "Mute this thread? ")) (let ((response (mastodon-http--post url))) (mastodon-http--triage response (lambda () - (message "Thread muted!")))))))))) + (if unmute + (message "Thread unmuted!") + (message "Thread muted!"))))))))))) (defun mastodon-tl--user-in-thread-p (id) "Return non-nil if the logged-in user has posted to the current thread. -- cgit v1.2.3 From b9865a58cf7f73c5205390dbf4df32d723ba15af Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 27 Nov 2022 13:19:00 +0100 Subject: autoloads and docstrings --- lisp/mastodon-tl.el | 9 +++++++-- lisp/mastodon-toot.el | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index fbf1b7b..2503516 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -79,6 +79,11 @@ (autoload 'mastodon-http--build-params-string "mastodon-http") (autoload 'mastodon-notifications--filter-types-list "mastodon-notifications") (autoload 'mastodon-toot--get-toot-edits "mastodon-toot") +(autoload 'mastodon-toot--update-status-fields "mastodon-toot") +(autoload 'mastodon-toot--compose-buffer "mastodon-toot") + +(defvar mastodon-toot--visibility) +(defvar mastodon-active-user) (when (require 'mpv nil :no-error) (declare-function mpv-start "mpv")) @@ -1157,7 +1162,7 @@ this just means displaying toot client." (let* ((poll (mastodon-tl--field 'poll toot)) (expiry (mastodon-tl--field 'expires_at poll)) (expired-p (if (eq (mastodon-tl--field 'expired poll) :json-false) nil t)) - (multi (mastodon-tl--field 'multiple poll)) + ;; (multi (mastodon-tl--field 'multiple poll)) (voters-count (mastodon-tl--field 'voters_count poll)) (vote-count (mastodon-tl--field 'votes_count poll)) (options (mastodon-tl--field 'options poll)) @@ -1539,7 +1544,7 @@ If UNMUTE, unmute it." (if (not we-posted-p) (message "You can only (un)mute a thread you have posted in.") (when (if unmute - (y-or-n-p "Unute this thread? ") + (y-or-n-p "Unnute this thread? ") (y-or-n-p "Mute this thread? ")) (let ((response (mastodon-http--post url))) (mastodon-http--triage response diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 099ce10..ae7dae2 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -788,8 +788,8 @@ instance to edit a toot." (defun mastodon-toot--insert-toot-iter (it) "Insert iteration IT of toot." - (let ((content (alist-get 'content it)) - (account (alist-get 'account it))) + (let ((content (alist-get 'content it))) + ;; (account (alist-get 'account it)) ;; TODO: handle polls, media (mastodon-tl--render-text content))) @@ -827,7 +827,7 @@ eg. \"feduser@fed.social\" -> \"feduser@fed.social\"." ""))) (defun mastodon-toot--get-bounds (regex) - "Get bounds of tag or handle before point." + "Get bounds of tag or handle before point using REGEX." ;; needed because # and @ are not part of any existing thing at point (save-match-data (save-excursion -- cgit v1.2.3 From 71152484c86abad4da8e699ed095de8319aa5cad Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 27 Nov 2022 13:21:48 +0100 Subject: try to declare company-mode-on --- lisp/mastodon-toot.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index ae7dae2..40ff0ee 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1434,7 +1434,9 @@ a draft into the buffer." 'completion-at-point-functions #'mastodon-toot--tags-capf) ;; company - (when mastodon-toot--use-company-for-completion + (when (and mastodon-toot--use-company-for-completion + (require 'company nil :no-error)) + (declare-function 'company-mode-on "company") (set (make-local-variable 'company-backends) (add-to-list 'company-backends 'company-capf)) (company-mode-on))) -- cgit v1.2.3 From f1c5b02512287a07899f793d667ce6924cbe88e8 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 27 Nov 2022 13:23:43 +0100 Subject: remove redundant str var --- lisp/mastodon-tl.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 2503516..ff00252 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1533,9 +1533,9 @@ If UNMUTE, unmute it." (if (string-suffix-p "context" endpoint) ; thread view (let* ((id (save-match-data - (let ((str (string-match "statuses/\\(?2:[[:digit:]]+\\)/context" - endpoint))) - (match-string 2 endpoint)))) + (string-match "statuses/\\(?2:[[:digit:]]+\\)/context" + endpoint) + (match-string 2 endpoint))) (we-posted-p (mastodon-tl--user-in-thread-p id)) (url (mastodon-http--api (if unmute -- cgit v1.2.3 From 279aabbbeed7e12f7034d11c83079a7e6fdaeedd Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 27 Nov 2022 13:42:57 +0100 Subject: compose buffer - display language selection only when selected --- lisp/mastodon-toot.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 40ff0ee..28733e1 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1211,6 +1211,9 @@ REPLY-TEXT is the text of the toot being replied to." (propertize "Visibility" 'toot-post-visibility t) " ⋅ " + (propertize "Language" + 'toot-post-language t) + " " (propertize "CW" 'toot-post-cw-flag t) " " @@ -1264,6 +1267,8 @@ REPLY-JSON is the full JSON of the toot being replied to." (point-min))) (cw-region (mastodon-tl--find-property-range 'toot-post-cw-flag (point-min))) + (lang-region (mastodon-tl--find-property-range 'toot-post-language + (point-min))) (toot-string (buffer-substring-no-properties (cdr header-region) (point-max)))) (add-text-properties (car count-region) (cdr count-region) @@ -1279,10 +1284,16 @@ REPLY-JSON is the full JSON of the toot being replied to." "private") "followers-only" mastodon-toot--visibility)))) + (add-text-properties (car lang-region) (cdr lang-region) + (list 'display + (if mastodon-toot--language + (format "Language: %s" + mastodon-toot--language) + ""))) (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)") + "NSFW" "NSFW (for attachments only)") "") 'face 'mastodon-cw-face)) (add-text-properties (car cw-region) (cdr cw-region) -- cgit v1.2.3 From 119d0de0ec1e916fc14a083368ac32e488d1263b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 27 Nov 2022 17:08:33 +0100 Subject: update copyright/author attribution --- lisp/mastodon-discover.el | 2 ++ lisp/mastodon-http.el | 2 ++ lisp/mastodon-inspect.el | 2 ++ lisp/mastodon-media.el | 2 ++ lisp/mastodon-notifications.el | 2 ++ lisp/mastodon-profile.el | 2 ++ lisp/mastodon-tl.el | 1 + lisp/mastodon-toot.el | 1 + 8 files changed, 14 insertions(+) diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el index 08df46e..1b960e5 100644 --- a/lisp/mastodon-discover.el +++ b/lisp/mastodon-discover.el @@ -1,7 +1,9 @@ ;;; mastodon-discover.el --- Use Mastodon.el with discover.el -*- lexical-binding: t -*- ;; Copyright (C) 2019 Johnson Denen +;; Copyright (C) 2020-2022 Marty Hiatt ;; Author: Johnson Denen +;; Marty Hiatt ;; Maintainer: Marty Hiatt ;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index d677e57..9ef7aec 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -1,7 +1,9 @@ ;;; mastodon-http.el --- HTTP request/response functions for mastodon.el -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen +;; Copyright (C) 2020-2022 Marty Hiatt ;; Author: Johnson Denen +;; Marty Hiatt ;; Maintainer: Marty Hiatt ;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1") (request "0.3.0")) diff --git a/lisp/mastodon-inspect.el b/lisp/mastodon-inspect.el index cbf6a8e..112a753 100644 --- a/lisp/mastodon-inspect.el +++ b/lisp/mastodon-inspect.el @@ -1,7 +1,9 @@ ;;; mastodon-inspect.el --- Client for Mastodon -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen +;; Copyright (C) 2020-2022 Marty Hiatt ;; Author: Johnson Denen +;; Marty Hiatt ;; Maintainer: Marty Hiatt ;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index c783130..4e50dbc 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -1,7 +1,9 @@ ;;; mastodon-media.el --- Functions for inlining Mastodon media -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen +;; Copyright (C) 2020-2022 Marty Hiatt ;; Author: Johnson Denen +;; Marty Hiatt ;; Maintainer: Marty Hiatt ;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index f5ddea3..b7fe038 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -1,7 +1,9 @@ ;;; mastodon-notifications.el --- Notification functions for mastodon.el -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen +;; Copyright (C) 2020-2022 Marty Hiatt ;; Author: Johnson Denen +;; Marty Hiatt ;; Maintainer: Marty Hiatt ;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 1200972..babe308 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -1,7 +1,9 @@ ;;; mastodon-profile.el --- Functions for inspecting Mastodon profiles -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen +;; Copyright (C) 2020-2022 Marty Hiatt ;; Author: Johnson Denen +;; Marty Hiatt ;; Maintainer: Marty Hiatt ;; Version: 1.0.0 ;; Package-Requires: ((emacs "27.1")) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index ff00252..76cca6c 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1,6 +1,7 @@ ;;; mastodon-tl.el --- HTTP request/response functions for mastodon.el -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen +;; Copyright (C) 2020-2022 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 28733e1..121a590 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1,6 +1,7 @@ ;;; mastodon-toot.el --- Minor mode for sending Mastodon toots -*- lexical-binding: t -*- ;; Copyright (C) 2017-2019 Johnson Denen +;; Copyright (C) 2020-2022 Marty Hiatt ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt -- cgit v1.2.3