From 79158bd0fd0c67aab90f8ae52d4f90b4b167be22 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 12 Nov 2022 15:38:21 +0100 Subject: wholly remove parent-toot; use base-toot/-id only the confusion came from the three different types of statuses we often encounter: - toot - boost/fave - notification (of boost/fave/mention) in notifications, we can't just use -tl--toot-id. it will return the notif's id, not the base toot's. so we do still fetch base-toot JSON (formerly 'parent-toot prop), and get base-toot-id from there, else from toot JSON. --- lisp/mastodon-notifications.el | 6 +++--- lisp/mastodon-tl.el | 46 +++++++++++++++++------------------------- lisp/mastodon-toot.el | 13 ++++++------ 3 files changed, 28 insertions(+), 37 deletions(-) diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index c0ca684..4e8fbdb 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -223,7 +223,7 @@ Status notifications are given when (defun mastodon-notifications--insert-status (toot body author-byline action-byline id - &optional parent-toot) + &optional base-toot) "Display the content and byline of timeline element TOOT. BODY will form the section of the toot above the byline. @@ -238,10 +238,10 @@ takes a single function. By default it is `mastodon-tl--byline-boosted'. ID is the notification's own id, which is attached as a property. -If the status is a favourite or a boost, PARENT-TOOT is the JSON +If the status is a favourite or a boost, BASE-TOOT is the JSON of the toot responded to." (when toot ; handle rare blank notif server bug - (mastodon-tl--insert-status toot body author-byline action-byline id parent-toot))) + (mastodon-tl--insert-status toot body author-byline action-byline id base-toot))) (defun mastodon-notifications--by-type (note) "Filters NOTE for those listed in `mastodon-notifications--types-alist'." diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 3f5dd04..bd2f9d6 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -938,7 +938,7 @@ Runs `mastodon-tl--render-text' and fetches poll or media." (mastodon-tl--media toot)))) (defun mastodon-tl--insert-status (toot body author-byline action-byline - &optional id parent-toot detailed-p) + &optional id base-toot detailed-p) "Display the content and byline of timeline element TOOT. BODY will form the section of the toot above the byline. @@ -950,9 +950,10 @@ such as boosting favouriting and following to the byline. It also takes a single function. By default it is `mastodon-tl--byline-boosted'. -ID is that of the toot, which is attached as a property if it is -a notification. If the status is a favourite or a boost, -PARENT-TOOT is the JSON of the toot responded to. +ID is that of the status if it is a notification, which is +attached as a `toot-id' property if provided. If the +status is a favourite or boost notification, BASE-TOOT is the +JSON of the toot responded to. DETAILED-P means display more detailed info. For now this just means displaying toot client." @@ -963,13 +964,16 @@ this just means displaying toot client." body " \n" (mastodon-tl--byline toot author-byline action-byline detailed-p)) - 'toot-id (or id ; for notifications - (alist-get 'id toot)) + 'toot-id (or id ; notification's own id + (alist-get 'id toot)) ; toot id 'base-toot-id (mastodon-tl--toot-id - ;; if a favourite/boost notif, get ID of toot responded to: - (or parent-toot toot)) + ;; if status is a notif, get id from base-toot + ;; (-tl--toot-id toot) will not work here: + (or base-toot + ;; else normal toot with reblog check: + toot)) 'toot-json toot - 'parent-toot parent-toot) + 'base-toot base-toot) "\n") (when mastodon-tl--display-media-p (mastodon-media--inline-images start-pos (point))))) @@ -1268,20 +1272,11 @@ webapp" (reblog (alist-get 'reblog json))) (if reblog (alist-get 'id reblog) id))) -(defun mastodon-tl--single-toot (&optional id) +(defun mastodon-tl--single-toot (id) "View toot at point in separate buffer. ID is that of the toot to view." (interactive) - (let* ((id - (or id - (if (equal (mastodon-tl--get-endpoint) "notifications") - ;; for boosts/faves: - (if (mastodon-tl--property 'parent-toot) - (mastodon-tl--as-string (mastodon-tl--toot-id - (mastodon-tl--property 'parent-toot))) - (mastodon-tl--property 'base-toot-id)) - (mastodon-tl--property 'base-toot-id)))) - (buffer (format "*mastodon-toot-%s*" id)) + (let* ((buffer (format "*mastodon-toot-%s*" id)) (toot (mastodon-http--get-json (mastodon-http--api (concat "statuses/" id))))) (if (equal (caar toot) 'error) @@ -1300,13 +1295,10 @@ ID is that of the toot to view." (interactive) (let* ((id (or id - (if (equal (mastodon-tl--get-endpoint) "notifications") - ;; for boosts/faves: - (if (mastodon-tl--property 'parent-toot) - (mastodon-tl--as-string (mastodon-tl--toot-id - (mastodon-tl--property 'parent-toot))) - (mastodon-tl--property 'base-toot-id)) - (mastodon-tl--property 'base-toot-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) + )) (url (mastodon-http--api (format "statuses/%s/context" id))) (buffer (format "*mastodon-thread-%s*" id)) (toot diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index e203cda..65649b8 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -816,16 +816,15 @@ 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)) - ;; NB: we cannot use mastodon-tl--property for 'parent-toot + ;; NB: we cannot use mastodon-tl--property for 'base-toot ;; because if it doesn't have one, it is fetched from next toot! ;; we also cannot use --field because we need to get a different property first - (parent (get-text-property (point) 'parent-toot)) ; for new notifs handling - (id (mastodon-tl--as-string - (mastodon-tl--field 'id (or parent toot)))) + (base-toot (get-text-property (point) 'base-toot)) ; for new notifs handling + (id (mastodon-tl--as-string (mastodon-tl--field 'id (or base-toot toot)))) (account (mastodon-tl--field 'account toot)) (user (alist-get 'acct account)) - (mentions (mastodon-toot--mentions (or parent toot))) - (boosted (mastodon-tl--field 'reblog (or parent toot))) + (mentions (mastodon-toot--mentions (or base-toot toot))) + (boosted (mastodon-tl--field 'reblog (or base-toot toot))) (booster (when boosted (alist-get 'acct (alist-get 'account toot))))) @@ -853,7 +852,7 @@ text of the toot being replied to in the compose buffer." ;; user in mentions already: mentions))) id - (or parent toot)))) + (or base-toot toot)))) (defun mastodon-toot--toggle-warning () "Toggle `mastodon-toot--content-warning'." -- cgit v1.2.3 From 32939e5ea4d44b05a4136b9cda64ff3d21728750 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 12 Nov 2022 17:30:55 +0100 Subject: don't try to load thread if status at point is foll_req --- lisp/mastodon-tl.el | 80 +++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index bd2f9d6..355c215 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1297,45 +1297,47 @@ ID is that of the toot to view." (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) - )) - (url (mastodon-http--api (format "statuses/%s/context" id))) - (buffer (format "*mastodon-thread-%s*" id)) - (toot - ;; refetch current toot in case we just faved/boosted: - (mastodon-http--get-json - (mastodon-http--api (concat "statuses/" id)) - :silent)) - (context (mastodon-http--get-json url :silent)) - (marker (make-marker))) - (if (equal (caar toot) 'error) - (message "Error: %s" (cdar toot)) - (when (member (alist-get 'type toot) '("reblog" "favourite")) - (setq toot (alist-get 'status toot))) - (if (> (+ (length (alist-get 'ancestors context)) - (length (alist-get 'descendants context))) - 0) - ;; if we have a thread: - (progn - (with-output-to-temp-buffer buffer - (switch-to-buffer buffer) - (mastodon-mode) - (mastodon-tl--set-buffer-spec - buffer - (format "statuses/%s/context" id) - (lambda (_toot) (message "END of thread."))) - (let ((inhibit-read-only t)) - (mastodon-tl--timeline (alist-get 'ancestors context)) - (goto-char (point-max)) - (move-marker marker (point)) - ;; print re-fetched toot: - (mastodon-tl--toot toot :detailed-p) - (mastodon-tl--timeline (alist-get 'descendants context)))) - ;; put point at the toot: - (goto-char (marker-position marker)) - (mastodon-tl--goto-next-toot)) - ;; else just print the lone toot: - (mastodon-tl--single-toot id))))) + (get-text-property (point) 'base-toot-id))) + (type (mastodon-tl--field 'type (mastodon-tl--property 'toot-json)))) + (if (string= type "follow_request") ; no can thread this + (error "No thread") + (let* ((url (mastodon-http--api (format "statuses/%s/context" id))) + (buffer (format "*mastodon-thread-%s*" id)) + (toot + ;; refetch current toot in case we just faved/boosted: + (mastodon-http--get-json + (mastodon-http--api (concat "statuses/" id)) + :silent)) + (context (mastodon-http--get-json url :silent)) + (marker (make-marker))) + (if (equal (caar toot) 'error) + (message "Error: %s" (cdar toot)) + (when (member (alist-get 'type toot) '("reblog" "favourite")) + (setq toot (alist-get 'status toot))) + (if (> (+ (length (alist-get 'ancestors context)) + (length (alist-get 'descendants context))) + 0) + ;; if we have a thread: + (progn + (with-output-to-temp-buffer buffer + (switch-to-buffer buffer) + (mastodon-mode) + (mastodon-tl--set-buffer-spec + buffer + (format "statuses/%s/context" id) + (lambda (_toot) (message "END of thread."))) + (let ((inhibit-read-only t)) + (mastodon-tl--timeline (alist-get 'ancestors context)) + (goto-char (point-max)) + (move-marker marker (point)) + ;; print re-fetched toot: + (mastodon-tl--toot toot :detailed-p) + (mastodon-tl--timeline (alist-get 'descendants context)))) + ;; put point at the toot: + (goto-char (marker-position marker)) + (mastodon-tl--goto-next-toot)) + ;; else just print the lone toot: + (mastodon-tl--single-toot id))))))) (defun mastodon-tl--create-filter () "Create a filter for a word. -- cgit v1.2.3 From 068ab5a5cd17cb04741598ef631d13da004ca8bc Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 12 Nov 2022 17:38:34 +0100 Subject: allow boost/fave of base toot from notifs --- lisp/mastodon-toot.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 65649b8..0571c3b 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -294,9 +294,13 @@ TYPE is a symbol, either 'favourite or 'boost." (cond ;; actually there's nothing wrong with faving/boosting own toots! ;;((mastodon-toot--own-toot-p (mastodon-tl--property 'toot-json)) ;;(error "You can't %s your own toots" action-string)) - ((equal "reblog" toot-type) + ;; & nothing wrong with faving/boosting own toots from notifs: + ;; this boosts/faves the base toot, not the notif status + ((and (equal "reblog" toot-type) + (not (string= (mastodon-tl--get-endpoint) "notifications"))) (error "You can't %s boosts" action-string)) - ((equal "favourite" toot-type) + ((and (equal "favourite" toot-type) + (not (string= (mastodon-tl--get-endpoint) "notifications"))) (error "Your can't %s favourites" action-string)) (t (mastodon-toot--action -- cgit v1.2.3 From 4cd72d73597ee6a5098bdbfb4b22d302e02e618c Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sun, 13 Nov 2022 19:07:35 +0100 Subject: fetch and use max chars per option for polls --- lisp/mastodon-toot.el | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 0571c3b..02dc075 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -967,9 +967,18 @@ which is used to attach it to a toot when posting." collect `(,key . ,o)))) (defun mastodon-toot--fetch-max-poll-options () - "Return the maximum number of poll options from the user's instance. " + "Return the maximum number of poll options." + (mastodon-toot--fetch-poll-field 'max_options)) + +(defun mastodon-toot--fetch-max-poll-option-chars () + "Return the maximum number of characters a poll option may have." + (or (mastodon-toot--fetch-poll-field 'max_characters_per_option) + 50)) ; masto default + +(defun mastodon-toot--fetch-poll-field (field) + "Return FIELD from the poll settings from the user's instance. " (let* ((instance (mastodon-http--get-json (mastodon-http--api "instance")))) - (alist-get 'max_options + (alist-get field (alist-get 'polls (alist-get 'configuration instance) instance)))) @@ -988,19 +997,20 @@ MAX is the maximum number set by their instance." (interactive) ;; re length, API docs show a poll 9 options. (let* ((max-options (mastodon-toot--fetch-max-poll-options)) - (length (mastodon-toot--read-poll-options-count max-options)) + (count (mastodon-toot--read-poll-options-count max-options)) + (length (mastodon-toot--fetch-max-poll-option-chars)) (multiple-p (y-or-n-p "Multiple choice? ")) - (options (mastodon-toot--read-poll-options length)) + (options (mastodon-toot--read-poll-options count length)) (hide-totals (y-or-n-p "Hide votes until poll ends? ")) (expiry (mastodon-toot--get-poll-expiry))) (setq mastodon-toot-poll `(:options ,options :length ,length :multi ,multiple-p :hide ,hide-totals :expiry ,expiry)) (message "poll created!"))) -(defun mastodon-toot--read-poll-options (length) +(defun mastodon-toot--read-poll-options (count length) "Read a list of options for poll of LENGTH options." - (cl-loop for x from 1 to length - collect (read-string (format "Poll option [%s/%s]: " x length)))) + (cl-loop for x from 1 to count + collect (read-string (format "Poll option [%s/%s] [max %s chars]: " x count length)))) (defun mastodon-toot--get-poll-expiry () "Prompt for a poll expiry time." -- cgit v1.2.3 From 75d30456f71dc16c0770dae98115c9fa5b514f4f 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 da2d442..86afee2 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -287,9 +287,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 60b707fe7fdb2471fa2a868d158ed1360bf8fb3f 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 86afee2..11741e1 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 d5883843fc82e1ba357d8561ce18434f1775307b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 14 Nov 2022 12:36:11 +0100 Subject: view-instance-description -- pleroma compat --- lisp/mastodon-tl.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index ebf3570..a312c0c 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1508,8 +1508,13 @@ INSTANCE is an instance domain name." (username (alist-get 'username account)) (instance (if instance (concat "https://" instance) - (string-remove-suffix (concat "/@" username) - url))) + ;; pleroma URL is https://instance.com/users/username + (if (string-suffix-p "users/" (url-basepath url)) + (string-remove-suffix "/users/" + (url-basepath url)) + ;; mastodon: + (string-remove-suffix (concat "/@" username) + url)))) (response (mastodon-http--get-json (if user (mastodon-http--api "instance") -- cgit v1.2.3 From a7115bf7eb1339ef85f10028ea8c4b6214aedaad Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 14 Nov 2022 15:16:41 +0100 Subject: remove commented --show-avatars var --- lisp/mastodon-tl.el | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index a312c0c..e8b94d7 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -106,12 +106,6 @@ width fonts when rendering HTML text")) :group 'mastodon-tl :type '(boolean :tag "Whether to display user avatars in timelines")) -;; (defvar mastodon-tl--show-avatars nil -;; (if (version< emacs-version "27.1") -;; (image-type-available-p 'imagemagick) -;; (image-transforms-p)) -;; "A boolean value stating whether to show avatars in timelines.") - (defvar-local mastodon-tl--update-point nil "When updating a mastodon buffer this is where new toots will be inserted. -- cgit v1.2.3 From 7593590d5c7a1ea9824424cc46d0cad4130eb9b2 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 14 Nov 2022 15:41:08 +0100 Subject: view instance description: handle calling from empty profiles --- lisp/mastodon-tl.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index e8b94d7..3e8c08d 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1494,12 +1494,19 @@ BRIEF means to show fewer details. INSTANCE is an instance domain name." (interactive) (mastodon-tl--do-if-toot - (let* ((toot (mastodon-tl--property 'toot-json)) + (let* ((profile-p (get-text-property (point) 'profile-json)) + (toot (if profile-p + (mastodon-tl--property 'profile-json) ; profile may have 0 toots + (mastodon-tl--property 'toot-json))) (reblog (alist-get 'reblog toot)) (account (or (alist-get 'account reblog) (alist-get 'account toot))) - (url (alist-get 'url account)) - (username (alist-get 'username account)) + (url (if profile-p + (alist-get 'url toot) ; profile + (alist-get 'url account))) + (username (if profile-p + (alist-get 'username toot) ;; profile + (alist-get 'username account))) (instance (if instance (concat "https://" instance) ;; pleroma URL is https://instance.com/users/username -- cgit v1.2.3 From a2bcbb47f32abcfae496a8d0aa27ec8a59101c60 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 15 Nov 2022 14:33:17 +0100 Subject: url-lookup: no tl--property calls allowed in tl--thread! --- lisp/mastodon-tl.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 3e8c08d..86a7b56 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1301,13 +1301,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") -- cgit v1.2.3 From 2cc11e4dd5b77c97922663ac9e4df4d48e77dcde Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 15 Nov 2022 14:48:12 +0100 Subject: only propertize handles and tags if they are bounded by non-words fixes accidental propertizing of handles in links --- lisp/mastodon-toot.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 () -- cgit v1.2.3