From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yagnesh Raghava Yakkala Newsgroups: gmane.emacs.help Subject: Re: Turning comments into hyperlinks Date: Wed, 18 Jul 2012 23:49:40 +0900 Message-ID: <878veh2kfv.fsf@yagnesh.org> References: <87txx5gn3n.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1342622988 7400 80.91.229.3 (18 Jul 2012 14:49:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 18 Jul 2012 14:49:48 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Pascal J. Bourguignon" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 18 16:49:48 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SrVZT-0008LK-4O for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Jul 2012 16:49:47 +0200 Original-Received: from localhost ([::1]:54887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrVZS-0008LK-4Q for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Jul 2012 10:49:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrVZN-0008Kz-7z for help-gnu-emacs@gnu.org; Wed, 18 Jul 2012 10:49:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrVZL-0002oi-Q9 for help-gnu-emacs@gnu.org; Wed, 18 Jul 2012 10:49:41 -0400 Original-Received: from mailgate4.sys.hokudai.ac.jp ([133.87.1.147]:39067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrVZL-0002oN-96 for help-gnu-emacs@gnu.org; Wed, 18 Jul 2012 10:49:39 -0400 Original-Received: from mailgate4.sys.hokudai.ac.jp (localhost.localdomain [127.0.0.1]) by localhost.sys.hokudai.ac.jp (Postfix) with ESMTP id 615B342DF1C for ; Wed, 18 Jul 2012 23:49:36 +0900 (JST) Original-Received: from okhotsk19 (okhotsk19.lowtem.hokudai.ac.jp [133.87.217.175]) by mailgate4.sys.hokudai.ac.jp (Postfix) with ESMTP id 53FBE42DE8C for ; Wed, 18 Jul 2012 23:49:35 +0900 (JST) Original-Received: from localhost (okhotsk19 [127.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by okhotsk19 (Postfix) with ESMTPS id 6AC3F281EDD; Wed, 18 Jul 2012 23:49:40 +0900 (JST) In-Reply-To: <87txx5gn3n.fsf@kuiper.lan.informatimago.com> (Pascal J. Bourguignon's message of "Wed, 18 Jul 2012 16:28:28 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 133.87.1.147 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85918 Archived-At: Hello Pascal, "Pascal J. Bourguignon" writes: > Sohail Somani 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. I think It would have been good, if `ffap' functions(or some other generic = library) are more user customizable to allow such a use cases. An alist with "regex-pattern . action-func" Just a thought. Thanks., --=20 =E0=B0=8E=E0=B0=82=E0=B0=A6=E0=B0=B0=E0=B1=8B =E0=B0=AE=E0=B0=B9=E0=B0=BE= =E0=B0=A8=E0=B1=81=E0=B0=AD=E0=B0=BE=E0=B0=B5=E0=B1=81=E0=B0=B2=E0=B1=81 = =E0=B0=85=E0=B0=82=E0=B0=A6=E0=B0=B0=E0=B0=BF=E0=B0=95=E0=B0=BF =E0=B0=B5= =E0=B0=82=E0=B0=A6=E0=B0=A8=E0=B0=AE=E0=B1=81=E0=B0=B2=E0=B1=81 YYR