Subject: bug#14950: 24.3.50; gnus: Fontification of URLs is not satisfactory

From: Jambunathan K <[email-masked]>
Date: Thu, 25 Jul 2013 17:45:25 +0530

Katsumi Yamaoka <[email-masked]> writes:

> Jambunathan K wrote:
>> Gnus is from Emacs repo.
>
>> Within Gnus,
>
>>   [Chicago Export filters for Org-mode]
>>   http://repo.or.cz/w/JabRefChicagoForOrgmode.git/blob_plain/HEAD:/net.sf.jabref.export.Chicago.ODF(English)-1.2.jar
>
>> How does the above URL below. Is it partly in bold and partly in default
>> font.  (See attached screenshot) Specifically, the URL is fontified only
>> till "1" (but doesn't include trailing ".2.jar" part).
>
> What should be improved is the default value of the user option
> `gnus-button-url-regexp'.  But it is too complicated to let me
> encourage to do it without enbugging.  Anyone?

I don't understand URLs.  

 (English)-1.2.jar
 ^       ^
 ^       ^

A quick X-ray operation with xr.el, suggested to me that the parenthesis
- () - around English could be the problem maker.  So I removed the ()
around English and re-builder matches the whole url.

Here is what xr.el reports.

xr.el is at http://debbugs.gnu.org/cgi/bugreport.cgi?msg=40;filename=xr.el;att=1;bug=13369

M-: (xr gnus-button-url-regexp)

--8<---------------cut here---------------start------------->8---

(seq
 word-boundary
 (group
  (group
   (or "www."
       (seq
	(group
	 (or
	  (seq
	   (opt "s")
	   "http"
	   (opt "s"))
	  "ftp" "file" "gopher" "nntp" "news" "telnet" "wais" "mailto" "info"))
	":")))
  (opt
   (group "//"
	  (one-or-more
	   (any "." "_" "0-9" "a-z" "-"))
	  ":"
	  (zero-or-more
	   (any "0-9"))))
  (or
   (seq
    (one-or-more
     (any "," "." ";" ":" "?" "!"
	  word "/" "\\" "+" "*" "&" "%" "~" "@" "$" "#" "=" "_" "0-9" "a-z" "-"))
    "("
    (one-or-more
     (any "," "." ";" ":" "?" "!"
	  word "/" "\\" "+" "*" "&" "%" "~" "@" "$" "#" "=" "_" "0-9" "a-z" "-"))
    (zero-or-more
     (any
      word "/" "\\" "+" "*" "&" "%" "~" "@" "$" "#" "=" "_" "0-9" "a-z" "-"))
    ")"
    (zero-or-more
     (any
      word "/" "\\" "+" "*" "&" "%" "~" "@" "$" "#" "=" "_" "0-9" "a-z" "-")))
   (seq
    (one-or-more
     (any "," "." ";" ":" "?" "!"
	  word "/" "\\" "+" "*" "&" "%" "~" "@" "$" "#" "=" "_" "0-9" "a-z" "-"))
    (any
     word "/" "\\" "+" "*" "&" "%" "~" "@" "$" "#" "=" "_" "0-9" "a-z" "-")))))

--8<---------------cut here---------------end--------------->8---

----------------------------------------------------------------

As an aside, 

If I do,
   
   M-x browse-url-emacs RET

with point on that link, I am prompted for the "whole" URL.  The
interactive spec for browse-url goes something like

  (interactive (browse-url-interactive-arg "URL: "))

which in turn relies on 

  (thing-at-point 'url t)

So may be Gnus, can fuzzily position itself on what looks like a URL and
then defer to `thing-at-point' to do the nasty work of identifying the
boundaries.  This way, atleast Gnus owners can blame someone else :-).