help-emacs-windows
[Top][All Lists]
Advanced

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

Re: [h-e-w] Display links in blue for browse-url


From: Jeff Rancier
Subject: Re: [h-e-w] Display links in blue for browse-url
Date: Tue, 26 Feb 2002 08:45:07 -0500

Daniel,

I cleaned up the regular expressions a bit.  I had a bit of trouble
understanding the different methods of using font-lock-add-keywords(), but
this appears to work.  Fixes, simplifications are welcome.

(setq font-lock-hyperlink-face (make-face 'font-lock-hyperlink-face))
(set-face-foreground 'font-lock-hyperlink-face "blue")
(set-face-underline-p 'font-lock-hyperlink-face t)

(font-lock-add-keywords 'emacs-lisp-mode

'(("\\([hH][tT][tT][pP][sS]?://[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1
font-lock-hyperlink-face prepend)

("\\([hH][tT][tT][pP][sS]?://[0-9a-zA-Z_-]+\.[0-9a-zA-Z_-]+\.[0-9a-zA-Z_-]+\
\)" 1 font-lock-hyperlink-face prepend)))

Jeff

----- Original Message -----
From: "Jason Rumney" <address@hidden>
To: "Jeff Rancier" <address@hidden>
Cc: "Daniel Hegyi" <address@hidden>; <address@hidden>
Sent: Monday, February 25, 2002 4:39 PM
Subject: Re: [h-e-w] Display links in blue for browse-url


| "Jeff Rancier" <address@hidden> writes:
|
| > (font-lock-add-keywords 'emacs-lisp-mode
| >                         '(("\\(^.*http:.*$\\)" 1
font-lock-hyperlink-face
| > prepend)))
| >
| > The only problem is that the whole line is underlined?  Can a more
seasoned
| > veteran assist with this?
|
| Try "\\(http:[^ \t\n]*\\)" as the regexp.  You don't want to match
| what's before the http:, and you only want to match up to the next
| whitespace character.
|
|
| --
| Jason Rumney




reply via email to

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