diff options
-rw-r--r-- | lisp/mastodon-notifications.el | 12 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 36 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 8 | ||||
-rw-r--r-- | lisp/mastodon.el | 6 |
4 files changed, 34 insertions, 28 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 7c5d40b..f05e670 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -73,6 +73,15 @@ ("Posted a poll" . "that has now ended")) "Alist of subjects for notification types.") +(defvar mastodon-notifications--map + (let ((map + (copy-keymap mastodon-mode-map))) + (define-key map (kbd "a") #'mastodon-notifications--follow-request-accept) + (define-key map (kbd "j") #'mastodon-notifications--follow-request-reject) + (define-key map (kbd "g") #'mastodon-notifications--get) + (keymap-canonicalize map)) + "Keymap for viewing notifications.") + (defun mastodon-notifications--byline-concat (message) "Add byline for TOOT with MESSAGE." (concat @@ -265,7 +274,8 @@ of the toot responded to." (mastodon-tl--init-sync "notifications" "notifications" - 'mastodon-notifications--timeline)) + 'mastodon-notifications--timeline) + (use-local-map mastodon-notifications--map)) (defun mastodon-notifications--clear-all () "Clear all notifications." diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index daa6626..27241f5 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -379,17 +379,10 @@ Used on initializing a timeline or thread." (name (if (not (string-empty-p (alist-get 'display_name account))) (alist-get 'display_name account) (alist-get 'username account))) - (profile-url (alist-get 'url account)) - (avatar-url (alist-get 'avatar account))) - ;; TODO: Once we have a view for a user (e.g. their posts - ;; timeline) make this a tab-stop and attach an action + (profile-url (alist-get 'url account))) (concat - (when (and mastodon-tl--show-avatars - mastodon-tl--display-media-p - (if (version< emacs-version "27.1") - (image-type-available-p 'imagemagick) - (image-transforms-p))) - (mastodon-media--get-avatar-rendering avatar-url)) + ;; avatar insertion moved up to `mastodon-tl--byline' in order to be + ;; outside of text prop 'byline t. (propertize name 'face 'mastodon-display-name-face ;; enable playing of videos when point is on byline: @@ -581,7 +574,9 @@ this just means displaying toot client." (bookmark-str (if (fontp (char-displayable-p #10r128278)) "🔖" "K")) - (visibility (mastodon-tl--field 'visibility toot))) + (visibility (mastodon-tl--field 'visibility toot)) + (account (alist-get 'account toot)) + (avatar-url (alist-get 'avatar account))) (concat ;; Boosted/favourited markers are not technically part of the byline, so ;; we don't propertize them with 'byline t', as per the rest. This @@ -596,6 +591,14 @@ this just means displaying toot client." (mastodon-tl--format-faved-or-boosted-byline "F")) (when bookmarked (mastodon-tl--format-faved-or-boosted-byline bookmark-str))) + ;; 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 + mastodon-tl--display-media-p + (if (version< emacs-version "27.1") + (image-type-available-p 'imagemagick) + (image-transforms-p))) + (mastodon-media--get-avatar-rendering avatar-url)) (propertize (concat ;; we propertize help-echo format faves for author name @@ -1328,13 +1331,12 @@ ID is that of the toot to view." (defun mastodon-tl--thread (&optional id) "Open thread buffer for toot at point or with ID." + ;; NB: this is called by `mastodon-url-lookup', which means it must work + ;; without `mastodon-tl--buffer-spec' being set! + ;; so avoid calls to `mastodon-tl--property' and friends (interactive) - (let* ((id - (or id - ;; avoid -tl--property here, we don't want to try next toot: - ;; this requires that 'base-toot-id always be set: - (get-text-property (point) 'base-toot-id))) - (type (mastodon-tl--field 'type (mastodon-tl--property 'toot-json)))) + (let* ((id (or id (get-text-property (point) 'base-toot-id))) + (type (mastodon-tl--field 'type (get-text-property (point) 'toot-json)))) (if (or (string= type "follow_request") (string= type "follow")) ; no can thread these (error "No thread") diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 02dc075..438e887 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 "#[1-9a-zA-Z_]+" + (mastodon-toot--propertize-item "[\n\t ]\\(?2:#[1-9a-zA-Z_]+\\)[\n\t ]" 'success (cdr header-region)) - (mastodon-toot--propertize-item "@[1-9a-zA-Z._-]+" + (mastodon-toot--propertize-item "[\n\t ]\\(?2:@[1-9a-zA-Z._-]+\\)[\n\t ]" 'mastodon-display-name-face (cdr header-region))))) @@ -1274,8 +1274,8 @@ Added to `after-change-functions'." (save-excursion (goto-char start) (cl-loop while (search-forward-regexp regex nil :noerror) - do (add-text-properties (match-beginning 0) - (match-end 0) + do (add-text-properties (match-beginning 2) + (match-end 2) `(face ,face))))) (defun mastodon-toot-compose-buffer-p () diff --git a/lisp/mastodon.el b/lisp/mastodon.el index ff245a4..e49a121 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -187,13 +187,7 @@ Use. e.g. \"%c\" for your locale's date and time format." (define-key map (kbd "i") #'mastodon-toot--pin-toot-toggle) (define-key map (kbd "V") #'mastodon-profile--view-favourites) (define-key map (kbd "R") #'mastodon-profile--view-follow-requests) - ;; (define-key map (kbd "C-c h") #'mastodon-async--stream-home) - ;; (define-key map (kbd "C-c f") #'mastodon-async--stream-federated) - ;; (define-key map (kbd "C-c l") #'mastodon-async--stream-local) - ;; (define-key map (kbd "C-c n") #'mastodon-async--stream-notifications) (define-key map (kbd "U") #'mastodon-profile--update-user-profile-note) - (define-key map (kbd "a") #'mastodon-notifications--follow-request-accept) - (define-key map (kbd "j") #'mastodon-notifications--follow-request-reject) (define-key map (kbd "v") #'mastodon-tl--poll-vote) (define-key map (kbd "k") #'mastodon-toot--bookmark-toot-toggle) (define-key map (kbd "K") #'mastodon-profile--view-bookmarks) |