aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-04-22 13:19:16 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-04-22 13:24:50 +0200
commiteacce3bf19b70b2a656e6a04b8b985f9bf56f297 (patch)
treeefb9ec06a7214a3e7fa625c0a5510a5364090135 /lisp/mastodon-toot.el
parent28e418cbbf8bfa3b600a8bf53361b93e2b8d9f3b (diff)
propertize urls in compose buffer. FIX #441.
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 8aa5597..6eb271d 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -228,6 +228,13 @@ send.")
"\\(?2:#[0-9a-zA-Z_]+\\)" ; tag
"\\b")) ; boundary
+(defvar mastodon-toot-url-regex
+ ;; adapted from ffap-url-regexp
+ (concat
+ "\\(?2:\\(news\\(post\\)?:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://\\)" ; uri prefix
+ "[^ \n\t]*\\)" ; any old thing that's, i.e. we allow invalid/unwise chars
+ "\\b")) ; boundary
+
(defvar mastodon-toot-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c C-c") #'mastodon-toot--send)
@@ -1627,6 +1634,9 @@ Added to `after-change-functions'."
(cdr header-region))
(mastodon-toot--propertize-item mastodon-toot-handle-regex
'mastodon-display-name-face
+ (cdr header-region))
+ (mastodon-toot--propertize-item mastodon-toot-url-regex
+ 'link
(cdr header-region)))))
(defun mastodon-toot--propertize-item (regex face start)