bug-gnu-emacs
[Top][All Lists]
Advanced

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

21.1: goto-addr.el does not process mailto: properly


From: Jeffrey C Honig
Subject: 21.1: goto-addr.el does not process mailto: properly
Date: Fri, 25 Oct 2002 17:30:02 -0400

In 21.1 through the current CVS sources, goto-addr does not properly
process a mailto: URL.  Instead of calling compose-mail, it passes the
URL to browse-url.

The reason for this is that goto-address-at-point verifies that it is
not looking at a valid URL when it detects an e-mail address.  It uses
the goto-address-url-regexp to check for a valid URL.  This regexp is
not supposed to match a mailto: URL.  But, in Rev 1.8 it was changed
from:

(defvar goto-address-url-regexp 
   (concat "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|"
          "telnet\\|wais\\):\\(//[-a-zA-Z0-9_.]+:"
          "[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*"
          "[-a-zA-Z0-9_=#$@~`%&*+|\\/]")
  "A regular expression probably matching a URL.")

to:

(defvar goto-address-url-regexp thing-at-point-url-regexp
;;;   (concat "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|"
;;;       "telnet\\|wais\\):\\(//[-a-zA-Z0-9_.]+:"
;;;       "[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*"
;;;       "[-a-zA-Z0-9_=#$@~`%&*+|\\/]")
  "A regular expression probably matching a URL.")

Notice that it is not supposed to match mailto:, but if you look at
thing-at-point-url-regexp it does match mailto.

I propose the following diff which takes advantage of
thing-at-point-url-regexp.  

--- goto-addr.el        Sun Jul 15 12:15:35 2001
+++ /home/jch/etc/gnu/goto-addr.el      Fri Oct 25 17:15:46 2002
@@ -101,11 +101,10 @@
   "[-a-zA-Z0-9._]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+"
   "A regular expression probably matching an e-mail address.")
 
-(defvar goto-address-url-regexp thing-at-point-url-regexp
-;;;   (concat "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|"
-;;;      "telnet\\|wais\\):\\(//[-a-zA-Z0-9_.]+:"
-;;;      "[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*"
-;;;      "[-a-zA-Z0-9_=#$@~`%&*+|\\/]")
+(defvar goto-address-url-regexp
+    (concat
+   
"\\<\\(https?://\\|ftp://\\|gopher://\\|telnet://\\|wais://\\|file:/\\|s?news:\\)"
+   thing-at-point-url-path-regexp)
   "A regular expression probably matching a URL.")
 
 (defvar goto-address-highlight-keymap

It might also be an idea to define thing-at-point-url-nomail-regexp
which is basically the same but hides the details in thingatpt.el.
 
Yes, I should have a disclaimer on file. 

Thanks.

Jeff




reply via email to

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