branch: elpa/fedi
commit 21b4e6dfa6c959d978cd5dc070b210475ca7ac40
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>

    fix: fedi-post-handle-regex: no opening +
---
 fedi-post.el | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/fedi-post.el b/fedi-post.el
index 4ebbcda4e24..f88ea1dcb05 100644
--- a/fedi-post.el
+++ b/fedi-post.el
@@ -115,21 +115,30 @@ face. no-label is optional.")
 
 (defvar fedi-post-handle-regex
   (rx (| (any ?\( "\n" "\t "" ") bol) ; preceding things
-      (group-n 2 (+ ?@ (* (any ?- ?_ ?. "A-Z" "a-z" "0-9" ))) ; handle
-               (? ?@ (* (not (any "\n" "\t" " "))))) ; optional domain
+      (group-n 1 ; = handle with @
+        ;; (+ ; breaks groups with instance handles!
+        ?@
+        (group-n 2 ; = username only
+          (* (any ?- ?_ ?. "A-Z" "a-z" "0-9" )))
+        (? ?@
+           (group-n 3 ; = optional domain
+             (* (not (any "\n" "\t" " "))))))
       (| "'" word-boundary))) ; boundary or possessive
 
 (defvar fedi-post-tag-regex
   (rx (| (any ?\( "\n" "\t" " ") bol)
       (group-n 2 ?# (+ (any "A-Z" "a-z" "0-9")))
-      (| "'" word-boundary))) ; boundary or possessive
+      (| "'" word-boundary)))
+                                        ; boundary or possessive
 
 (defvar fedi-post-url-regex
   ;; adapted from `ffap-url-regexp'
   (concat
-   
"\\(?2:\\(news\\(post\\)?:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://\\)"
 ; uri prefix
+   
"\\(?2:\\(news\\(post\\)?:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://\\)"
+                                        ; uri prefix
    "[^ \n\t]*\\)" ; any old thing, that is, i.e. we allow invalid/unwise chars
-   "\\b")) ; boundary
+   "\\b"))
+                                        ; boundary
 
 
 ;;; MODE MAP

Reply via email to