[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Turning comments into hyperlinks
From: |
Pascal J. Bourguignon |
Subject: |
Re: Turning comments into hyperlinks |
Date: |
Wed, 18 Jul 2012 16:28:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
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.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.