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

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

Re: Turning comments into hyperlinks


From: Sohail Somani
Subject: Re: Turning comments into hyperlinks
Date: Wed, 18 Jul 2012 11:28:02 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1

On 18/07/2012 10:28 AM, Pascal J. Bourguignon wrote:
Sohail Somani <sohail@taggedtype.net> writes:

Greetings Earthlings!

I have come across an inconvenience which I would like to resolve. I
am working on a codebase which has the following patterns throughout
the code:

// JIRA 12312
// ISSUE 12312
// KEY-12312

What I would like to do is match these patterns and turn them into
hyperlinks that open in the browser. So for example, I might turn
KEY-12312 into a hyperlink to http://jira.myhomies.com/KEY-12312 but
continue to display the original text.

How would I accomplish this with cc-mode or emacs in general?


Since those patterns seem to be safely recognizable with regular
expressions, you can use font-locking to identify them and substitute
with with an hyperlink button. The font-lock keyword definition would
use compose-region to overlay the text with a button which action would
browse the url you want.

Thanks, I'll look into this.






reply via email to

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