unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Getting minor mode to read word
@ 2010-11-18 13:39 Paulo J. Matos
  2010-11-18 13:54 ` Lennart Borgman
  0 siblings, 1 reply; 5+ messages in thread
From: Paulo J. Matos @ 2010-11-18 13:39 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

I am trying to create a very simple minor mode to start with. Once the
mode is loaded I just want to transform all the strings matching a given
regexp: "B-[0-9]+" into a url which once clicked, opens the default
browser with a given url.

My problem is to start up. How do I tell emacs that there is a minor
mode that people can load and which hook can I use to enable the search
function (for the regexp) to perform the search and replace the text for
a url everytime the buffer changes?

Cheers,

-- 
PMatos




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting minor mode to read word
  2010-11-18 13:39 Getting minor mode to read word Paulo J. Matos
@ 2010-11-18 13:54 ` Lennart Borgman
  2010-11-18 14:08   ` Paulo J. Matos
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Borgman @ 2010-11-18 13:54 UTC (permalink / raw)
  To: Paulo J. Matos; +Cc: help-gnu-emacs

On Thu, Nov 18, 2010 at 2:39 PM, Paulo J. Matos <pocmatos@gmail.com> wrote:
> Hi all,
>
> I am trying to create a very simple minor mode to start with. Once the
> mode is loaded I just want to transform all the strings matching a given
> regexp: "B-[0-9]+" into a url which once clicked, opens the default
> browser with a given url.
>
> My problem is to start up. How do I tell emacs that there is a minor
> mode that people can load and which hook can I use to enable the search
> function (for the regexp) to perform the search and replace the text for
> a url everytime the buffer changes?

Look at font lock keywords.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting minor mode to read word
  2010-11-18 13:54 ` Lennart Borgman
@ 2010-11-18 14:08   ` Paulo J. Matos
  2010-11-18 14:11     ` Lennart Borgman
  0 siblings, 1 reply; 5+ messages in thread
From: Paulo J. Matos @ 2010-11-18 14:08 UTC (permalink / raw)
  To: help-gnu-emacs

Lennart Borgman <lennart.borgman@gmail.com> writes:

>
> Look at font lock keywords.
>

Thanks for the tip. I thought that font lock was only used for
highlighting of text previously. From
http://www.gnu.org/software/emacs/manual/html_node/elisp/Search_002dbased-Fontification.html#Search_002dbased-Fontification

it seems that I might be able to attach a function to transform the
matched text.

Thanks,

-- 
PMatos




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting minor mode to read word
  2010-11-18 14:08   ` Paulo J. Matos
@ 2010-11-18 14:11     ` Lennart Borgman
  2010-11-18 15:01       ` Paulo J. Matos
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Borgman @ 2010-11-18 14:11 UTC (permalink / raw)
  To: Paulo J. Matos; +Cc: help-gnu-emacs

On Thu, Nov 18, 2010 at 3:08 PM, Paulo J. Matos <pocmatos@gmail.com> wrote:
> Lennart Borgman <lennart.borgman@gmail.com> writes:
>
>>
>> Look at font lock keywords.
>>
>
> Thanks for the tip. I thought that font lock was only used for
> highlighting of text previously. From
> http://www.gnu.org/software/emacs/manual/html_node/elisp/Search_002dbased-Fontification.html#Search_002dbased-Fontification
>
> it seems that I might be able to attach a function to transform the
> matched text.

Forgot: There is some code for things similar to this in for example
mlinks.el in nXhtml.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting minor mode to read word
  2010-11-18 14:11     ` Lennart Borgman
@ 2010-11-18 15:01       ` Paulo J. Matos
  0 siblings, 0 replies; 5+ messages in thread
From: Paulo J. Matos @ 2010-11-18 15:01 UTC (permalink / raw)
  To: help-gnu-emacs

Lennart Borgman <lennart.borgman@gmail.com> writes:

>
> Forgot: There is some code for things similar to this in for example
> mlinks.el in nXhtml.
>
>

Looking at it. A perfect example... thanks! :)

-- 
PMatos




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-18 15:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-18 13:39 Getting minor mode to read word Paulo J. Matos
2010-11-18 13:54 ` Lennart Borgman
2010-11-18 14:08   ` Paulo J. Matos
2010-11-18 14:11     ` Lennart Borgman
2010-11-18 15:01       ` Paulo J. Matos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).