From 608deff68713e7ea2561d0334b81a6a58e568f66 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 29 Mar 2024 13:47:16 +0100 Subject: bookmarking: no move when checking bookmarked-p status --- lisp/mastodon-tl.el | 2 ++ lisp/mastodon-toot.el | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 4c0375d..c3147b6 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1803,6 +1803,8 @@ Move forward (down) the timeline unless NO-MOVE is non-nil. BACKWARD means move backward (up) the timeline." (if no-move (get-text-property (point) prop) + ;; NB: this doesn't differentiate absence of property from + ;; property set to zero, making flag props fraught: (or (get-text-property (point) prop) (save-excursion (if backward diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index a48d5d9..d6232d5 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -459,7 +459,7 @@ SUBTRACT means we are un-favouriting or unboosting, so we decrement." (interactive) (mastodon-tl--do-if-item-strict (let* ((id (mastodon-tl--property 'base-item-id)) - (bookmarked-p (mastodon-tl--property 'bookmarked-p)) + (bookmarked-p (mastodon-tl--property 'bookmarked-p :no-move)) (byline-region (when id (mastodon-tl--find-property-range 'byline (point)))) (action (if bookmarked-p "unbookmark" "bookmark")) -- cgit v1.2.3 From d0853f95dd9ae3f6c467e5fe603cee863ff217c5 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 24 Apr 2024 19:56:26 +0200 Subject: -media.el: require image-mode --- lisp/mastodon-media.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index bc902aa..3f6d0df 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -35,6 +35,7 @@ ;;; Code: (require 'url-cache) (require 'mm-decode) +(require 'image-mode) (autoload 'mastodon-tl--propertize-img-str-or-url "mastodon-tl") -- cgit v1.2.3 From 3ce7ee184b81b8df47f89c57d0ea2cbd6ca645bb Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 24 Apr 2024 19:57:37 +0200 Subject: -profile.el: require mastodon-http --- lisp/mastodon-profile.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 7b5a700..2a5e350 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -37,6 +37,7 @@ (require 'cl-lib) (require 'persist) (require 'parse-time) +(require 'mastodon-http) (eval-when-compile (require 'mastodon-tl)) -- cgit v1.2.3 From e83a88740fb04225d0136cf79b8ae5511005f301 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 24 Apr 2024 20:46:18 +0200 Subject: revert changes to auth--show-notice so that we see the message prompt --- lisp/mastodon-auth.el | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/lisp/mastodon-auth.el b/lisp/mastodon-auth.el index 9f9d128..404dd57 100644 --- a/lisp/mastodon-auth.el +++ b/lisp/mastodon-auth.el @@ -112,18 +112,24 @@ When optional argument ASK is given which should be a string, use ASK as the minibuffer prompt. Return whatever user types in response to the prompt. When ASK is absent return nil." - (if ask - (read-string ask) - (let ((buffer (get-buffer-create buffer-name)) - (inhibit-read-only t)) - (set-buffer buffer) - (erase-buffer) - (insert notice) - (fill-region (point-min) (point-max)) - (read-only-mode) - (prog1 nil - (pop-to-buffer buffer '(display-buffer-in-side-window - (side . left) (window-width . 0.5))))))) + (let ((buffer (get-buffer-create buffer-name)) + (inhibit-read-only t) + ask-value window) + (set-buffer buffer) + (erase-buffer) + (insert notice) + (fill-region (point-min) (point-max)) + (read-only-mode) + + (setq window (select-window + (split-window (frame-root-window) nil 'below) + t)) + (switch-to-buffer buffer t) + (when ask + (setq ask-value (read-string ask)) + (kill-buffer buffer) + (delete-window window)) + ask-value)) (defun mastodon-auth--request-authorization-code () "Ask authorization code and return it." -- cgit v1.2.3 From 0739636698d83b6d25d58b832a8466c131e92450 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 24 Apr 2024 21:21:37 +0200 Subject: hack to fix item action toggling when point on item body --- lisp/mastodon-toot.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index d6232d5..aff201d 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -459,7 +459,14 @@ SUBTRACT means we are un-favouriting or unboosting, so we decrement." (interactive) (mastodon-tl--do-if-item-strict (let* ((id (mastodon-tl--property 'base-item-id)) - (bookmarked-p (mastodon-tl--property 'bookmarked-p :no-move)) + (bookmarked-p + (mastodon-tl--property + 'bookmarked-p + (if (mastodon-tl--property 'byline :no-move) + ;; no move if not in byline, the idea being if in body, we do + ;; move forward to byline to toggle correctly. + ;; alternatively we could bookmarked-p whole posts. + :no-move))) (byline-region (when id (mastodon-tl--find-property-range 'byline (point)))) (action (if bookmarked-p "unbookmark" "bookmark")) -- cgit v1.2.3 From ff758ff681e4549913998f461ee90562f04ee7e3 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 24 Apr 2024 21:21:57 +0200 Subject: store notif type as prop so we can limit item actions by notif type --- lisp/mastodon-tl.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index c3147b6..fa0c7bb 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1434,7 +1434,8 @@ THREAD means the status will be displayed in a thread view." (reply-to-id (alist-get 'in_reply_to_id toot)) (after-reply-status-p (when (and thread reply-to-id) - (mastodon-tl--after-reply-status reply-to-id)))) + (mastodon-tl--after-reply-status reply-to-id))) + (type (alist-get 'type toot))) (insert (propertize (concat @@ -1461,7 +1462,8 @@ THREAD means the status will be displayed in a thread view." toot)) ; else normal toot with reblog check 'item-json toot 'base-toot base-toot - 'cursor-face 'mastodon-cursor-highlight-face) + 'cursor-face 'mastodon-cursor-highlight-face + 'notification-type type) "\n") (when mastodon-tl--display-media-p (mastodon-media--inline-images start-pos (point))))) -- cgit v1.2.3 From 9dcffebf366e442d6f69240561a5909e8e8f4da0 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 2 May 2024 14:39:13 +0200 Subject: url-lookup: try shr-url prop before thing-at point thing at point captures the closing ) of URLs in brackets, which makes webfinger fail. maybe shr-url should always get first dibs before thing-at-point also? --- lisp/mastodon.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 70ab73c..1d071f7 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -370,8 +370,8 @@ If a status or account is found, load it in `mastodon.el', if not, just browse the URL in the normal fashion." (interactive) (let* ((query (or query-url - (thing-at-point-url-at-point) (mastodon-tl--property 'shr-url :no-move) + (thing-at-point-url-at-point) (read-string "Lookup URL: ")))) (if (and (not force) (not (mastodon--fedi-url-p query))) -- cgit v1.2.3 From e6bdc008ed3f66fd5c6903c491e1cf6d4dafd2f3 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 21 May 2024 12:40:19 +0200 Subject: profiles: support only-media arg --- lisp/mastodon-profile.el | 30 +++++++++++++++++++++--------- lisp/mastodon-tl.el | 2 ++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 2a5e350..fc318e2 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -142,11 +142,12 @@ contains") (mastodon-tl--property 'item-json)) (defun mastodon-profile--make-author-buffer - (account &optional no-reblogs no-replies) + (account &optional no-reblogs no-replies only-media) "Take an ACCOUNT json and insert a user account into a new buffer. NO-REBLOGS means do not display boosts in statuses." (mastodon-profile--make-profile-buffer-for - account "statuses" #'mastodon-tl--timeline no-reblogs nil no-replies)) + account "statuses" #'mastodon-tl--timeline no-reblogs nil + no-replies only-media)) ;; TODO: we shd just load all views' data then switch coz this is slow af: (defun mastodon-profile--account-view-cycle () @@ -157,6 +158,8 @@ NO-REBLOGS means do not display boosts in statuses." ((mastodon-tl--buffer-type-eq 'profile-statuses-no-boosts) (mastodon-profile--open-statuses-no-replies)) ((mastodon-tl--buffer-type-eq 'profile-statuses-no-replies) + (mastodon-profile--open-statuses-only-media)) + ((mastodon-tl--buffer-type-eq 'profile-statuses-only-media) (mastodon-profile--open-followers)) ((mastodon-tl--buffer-type-eq 'profile-followers) (mastodon-profile--open-following)) @@ -179,6 +182,14 @@ NO-REBLOGS means do not display boosts in statuses." mastodon-profile--account :no-reblogs) (user-error "Not in a mastodon profile"))) +(defun mastodon-profile--open-statuses-only-media () + "Open a profile buffer showing only statuses with media." + (interactive) + (if mastodon-profile--account + (mastodon-profile--make-author-buffer + mastodon-profile--account nil nil :only-media) + (user-error "Not in a mastodon profile"))) + (defun mastodon-profile--open-following () "Open a profile buffer showing the accounts that current profile follows." (interactive) @@ -567,7 +578,7 @@ 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 headers no-replies) + &optional no-reblogs headers no-replies only-media) "Display profile of ACCOUNT, using ENDPOINT-TYPE and UPDATE-FUNCTION. NO-REBLOGS means do not display boosts in statuses. HEADERS means also fetch link headers for pagination." @@ -577,17 +588,18 @@ HEADERS means also fetch link headers for pagination." (push '("exclude_reblogs" . "t") args)) (no-replies (push '("exclude_replies" . "t") args)) + (only-media + (push '("only_media" . "t") args)) (t args))) (endpoint (format "accounts/%s/%s" .id endpoint-type)) (url (mastodon-http--api endpoint)) (buffer (concat "*mastodon-" .acct "-" - (cond (no-reblogs - (concat endpoint-type "-no-boosts")) - (no-replies - (concat endpoint-type "-no-replies")) - (t - endpoint-type)) + (concat endpoint-type + (cond (no-reblogs "-no-boosts") + (no-replies "-no-replies") + (only-media "-only-media") + (t ""))) "*")) (response (if headers (mastodon-http--get-response url args) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index fa0c7bb..6c444d4 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1677,6 +1677,8 @@ call this function after it is set or use something else." 'profile-statuses-no-boosts) ((string-suffix-p "no-replies*" buffer-name) 'profile-statuses-no-replies) + ((string-suffix-p "only-media*" buffer-name) + 'profile-statuses-only-media) ((mastodon-tl--endpoint-str-= "statuses" :suffix) 'profile-statuses) ;; profile followers -- cgit v1.2.3