From eacce3bf19b70b2a656e6a04b8b985f9bf56f297 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Sat, 22 Apr 2023 13:19:16 +0200 Subject: propertize urls in compose buffer. FIX #441. --- lisp/mastodon-toot.el | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lisp/mastodon-toot.el') 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) -- cgit v1.2.3