From f42a3aea506b5258dcf3e2b55d211d89f68a6c8a Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 23 Mar 2023 15:11:58 +0100 Subject: make list-follow-tags idiot proof --- lisp/mastodon-tl.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 644a3d4..f557282 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -2037,8 +2037,10 @@ If TAG is provided, unfollow it." (interactive) (let* ((followed-tags-json (mastodon-tl--followed-tags)) (tags (mastodon-tl--map-alist 'name followed-tags-json)) - (tag (completing-read "Tag: " tags))) - (mastodon-tl--get-tag-timeline tag))) + (tag (completing-read "Tag: " tags nil))) + (if (null tag) + (message "You have to follow some tags first.") + (mastodon-tl--get-tag-timeline tag)))) ;;; UPDATING, etc. -- cgit v1.2.3 From 300d86f617f80e22a2926313f62ddbd06b992630 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 23 Mar 2023 23:25:14 +0100 Subject: replace hypen horiz-bars with unicode masto-tl--horiz-bar if poss --- lisp/mastodon-profile.el | 10 +++++----- lisp/mastodon-search.el | 16 ++++++++-------- lisp/mastodon-tl.el | 21 +++++++++++++-------- lisp/mastodon-views.el | 8 ++++---- 4 files changed, 30 insertions(+), 25 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 74f9b62..7fb36ad 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -642,7 +642,7 @@ HEADERS means also fetch link headers for pagination." (if (equal locked t) (concat " " (mastodon-tl--symbol 'locked)) "") - "\n ------------\n" + "\n " mastodon-tl--horiz-bar "\n" ;; profile note: ;; account here to enable tab-stops in profile note (mastodon-tl--render-text note account) @@ -662,11 +662,11 @@ HEADERS means also fetch link headers for pagination." 'profile-json account) ;; insert counts (mastodon-tl--set-face - (concat " ------------\n" + (concat " " mastodon-tl--horiz-bar "\n" " TOOTS: " toots-count " | " "FOLLOWERS: " followers-count " | " "FOLLOWING: " following-count "\n" - " ------------\n\n") + " " mastodon-tl--horiz-bar "\n\n") 'success) ;; insert relationship (follows) (if followsp @@ -682,9 +682,9 @@ HEADERS means also fetch link headers for pagination." "") ; if no followsp we still need str-or-char-p for insert ;; insert endpoint (mastodon-tl--set-face - (concat " ------------\n" + (concat " " mastodon-tl--horiz-bar "\n" endpoint-name "\n" - " ------------\n") + " " mastodon-tl--horiz-bar "\n") 'success)) (setq mastodon-tl--update-point (point)) (mastodon-media--inline-images (point-min) (point)) diff --git a/lisp/mastodon-search.el b/lisp/mastodon-search.el index b5900c7..3555238 100644 --- a/lisp/mastodon-search.el +++ b/lisp/mastodon-search.el @@ -97,9 +97,9 @@ QUERY is the string to search." nil) ;; hashtag results: (insert (mastodon-tl--set-face - (concat "\n ------------\n" + (concat "\n " mastodon-tl--horiz-bar "\n" " TRENDING HASHTAGS\n" - " ------------\n\n") + " " mastodon-tl--horiz-bar "\n\n") 'success)) (mastodon-search--print-tags-list tags))))) @@ -135,23 +135,23 @@ QUERY is the string to search." nil) ;; user results: (insert (mastodon-tl--set-face - (concat "\n ------------\n" + (concat "\n " mastodon-tl--horiz-bar "\n" " USERS\n" - " ------------\n\n") + " " mastodon-tl--horiz-bar "\n\n") 'success)) (mastodon-search--insert-users-propertized accts :note) ;; hashtag results: (insert (mastodon-tl--set-face - (concat "\n ------------\n" + (concat "\n " mastodon-tl--horiz-bar "\n" " HASHTAGS\n" - " ------------\n\n") + " " mastodon-tl--horiz-bar "\n\n") 'success)) (mastodon-search--print-tags-list tags-list) ;; status results: (insert (mastodon-tl--set-face - (concat "\n ------------\n" + (concat "\n " mastodon-tl--horiz-bar "\n" " STATUSES\n" - " ------------\n") + " " mastodon-tl--horiz-bar "\n") 'success)) (mapc #'mastodon-tl--toot toots-list-json) (goto-char (point-min)))))) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index f557282..fbee377 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -189,6 +189,10 @@ 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--horiz-bar + (if (char-displayable-p ?―) + (make-string 12 ?―) + (make-string 12 ?-))) ;;; KEYMAPS @@ -625,7 +629,8 @@ this just means displaying toot client." (mastodon-tl--relative-time-description edited-parsed) edited-parsed))) "") - (propertize "\n ------------" 'face 'default) + (propertize (concat "\n " mastodon-tl--horiz-bar) + 'face 'default) (if mastodon-tl--show-stats (mastodon-tl--toot-stats toot) "") @@ -962,13 +967,13 @@ message is a link which unhides/hides the main body." (mastodon-tl--clean-tabs-and-nl (mastodon-tl--render-text spoiler toot)) 'default)) - (message (concat ;"\n" - " ---------------\n" - " " (mastodon-tl--make-link - (concat "CW: " string) - 'content-warning) - "\n" - " ---------------\n")) + (message (concat + " " mastodon-tl--horiz-bar "\n " + (mastodon-tl--make-link + (concat "CW: " string) + 'content-warning) + "\n " + mastodon-tl--horiz-bar "\n")) (cw (mastodon-tl--set-face message 'mastodon-cw-face))) (concat cw diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index 22eac7e..97ef082 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -163,10 +163,10 @@ This function is used as the update-function to provides the JSON data." (erase-buffer) (insert (mastodon-tl--set-face - (concat "\n ------------\n " + (concat "\n " mastodon-tl--horiz-bar "\n " (upcase view-name) - "\n" - " ------------\n\n") + "\n " + mastodon-tl--horiz-bar "\n\n") 'success) (if bindings-string (mastodon-tl--set-face @@ -215,7 +215,7 @@ provides the JSON data." (mastodon-tl--map-alist 'title lists))) (mapc (lambda (x) (mastodon-views--print-list-accounts x) - (insert (propertize " ------------\n\n" + (insert (propertize (concat " " mastodon-tl--horiz-bar "\n\n") 'face 'success))) lists-names))) -- cgit v1.2.3 From c63bae68e445135882a2454c03ea28c3e13095cc Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 24 Mar 2023 09:07:50 +0100 Subject: FIX #419. call instance description on account listings fix --- lisp/mastodon-views.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el index 97ef082..9c016c3 100644 --- a/lisp/mastodon-views.el +++ b/lisp/mastodon-views.el @@ -733,22 +733,23 @@ INSTANCE is an instance domain name." (mastodon-views--instance-response-fun response brief instance)) (mastodon-tl--do-if-toot (let* ((toot (if (mastodon-tl--profile-buffer-p) - ;; we may be on profile itself: + ;; we may be on profile description itself: (or (mastodon-tl--property 'profile-json) ;; or on profile account listings, which use toot-json: ;; or just toots: (mastodon-tl--property 'toot-json)) - ;; normal timeline: + ;; normal timeline/account listing: (mastodon-tl--property 'toot-json))) (reblog (alist-get 'reblog toot)) (account (or (alist-get 'account reblog) - (alist-get 'account toot))) + (alist-get 'account toot) + toot)) ; else `toot' is already an account listing. ;; we can't use --profile-buffer-p as our test here because we may - ;; be looking at toots/boosts/users in a profile buffer + ;; be looking at toots/boosts/users in a profile buffer. ;; profile-json works as a defacto test for if point is on the ;; profile details at the top of a profile buffer. (url (if (mastodon-tl--property 'profile-json) - (alist-get 'url toot) ; profile + (alist-get 'url toot) ; profile description (alist-get 'url account))) (username (if (mastodon-tl--property 'profile-json) (alist-get 'username toot) ;; profile -- cgit v1.2.3 From 93ef38d88b277e8d5991e887034a7622879c91b1 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 24 Mar 2023 09:33:37 +0100 Subject: FIX #418. set-cw check for nil as well as string-empty set-cw is called by setup-as-reply, which always runs in --compose-buffer. perhaps it shouldn't. --- lisp/mastodon-toot.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 82a9482..65fc357 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -591,7 +591,8 @@ NO-REDRAFT means delete toot only." (defun mastodon-toot--set-cw (&optional cw) "Set content warning to CW if it is non-nil." - (unless (string-empty-p cw) + (unless (or (null cw) ; cw is nil for `mastodon-tl--dm-user' + (string-empty-p cw)) (setq mastodon-toot--content-warning t) (setq mastodon-toot--content-warning-from-reply-or-redraft cw))) @@ -1637,6 +1638,10 @@ EDIT means we are editing an existing toot, not composing a new one." (mastodon-toot--display-docs-and-status-fields (when mastodon-toot-display-orig-in-reply-buffer reply-text)) + ;; `reply-to-user' (alone) is also used by `mastodon-tl--dm-user', so + ;; perhaps we should not always call --setup-as-reply, or make its + ;; workings conditional on reply-to-id. currently it only checks for + ;; reply-to-user. (mastodon-toot--setup-as-reply reply-to-user reply-to-id reply-json)) (unless mastodon-toot--max-toot-chars ;; no need to fetch from `mastodon-profile-account-settings' as -- cgit v1.2.3