emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4bd5ac04a3: Teach thing-at-point to recognize bracketed IPv6 URLs


From: F. Jason Park
Subject: master 4bd5ac04a3: Teach thing-at-point to recognize bracketed IPv6 URLs
Date: Wed, 9 Nov 2022 08:22:03 -0500 (EST)

branch: master
commit 4bd5ac04a3b11228c8b7a9c7144503267bb8b9b4
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>

    Teach thing-at-point to recognize bracketed IPv6 URLs
    
    * lisp/thingatpt.el (thing-at-point-bounds-of-url-at-point): Allow
    IPv6 addresses as hosts.  Overshoots in the case of bracketed markup
    but is rescued by `thing-at-point--bounds-of-well-formed-url'.
    * test/lisp/thingatpt-tests.el (thing-at-point-test-data): Add cases
    for IPv6 URLs.  Bug#56514.
---
 lisp/thingatpt.el            | 2 +-
 test/lisp/thingatpt-tests.el | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 462f87d3c1..9dda3e1fcb 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -441,7 +441,7 @@ the bounds of a possible ill-formed URI (one lacking a 
scheme)."
       ;; Otherwise, find the bounds within which a URI may exist.  The
       ;; method is similar to `ffap-string-at-point'.  Note that URIs
       ;; may contain parentheses but may not contain spaces (RFC3986).
-      (let* ((allowed-chars "--:=&?$+@-Z_[:alpha:]~#,%;*()!'")
+      (let* ((allowed-chars "--:=&?$+@-Z_[:alpha:]~#,%;*()!'[]")
             (skip-before "^[0-9a-zA-Z]")
             (skip-after  ":;.,!?'")
             (pt (point))
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index b6d0b1446a..67dd00104b 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -44,6 +44,9 @@
     ;; Non alphanumeric characters can be found in URIs
     ("ftp://example.net/~foo!;#bar=baz&goo=bob"; 3 url 
"ftp://example.net/~foo!;#bar=baz&goo=bob";)
     ("bzr+ssh://user@example.net:5/a%20d,5" 34 url 
"bzr+ssh://user@example.net:5/a%20d,5")
+    ;; IPv6 brackets enclosed in [markup]
+    ("[http://[::1]:8000/foo]"; 10 url "http://[::1]:8000/foo";)
+    ("[http://[fe08::7:8%eth0]]"; 10 url "http://[fe08::7:8%eth0]";)
     ;; <url:...> markup
     ("Url: <url:foo://1.example.com>..." 8 url "foo://1.example.com")
     ("Url: <url:foo://2.example.com>..." 30 url "foo://2.example.com")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]