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

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

Re: Associating a region with a link


From: Nikolaj Schumacher
Subject: Re: Associating a region with a link
Date: Fri, 17 Oct 2008 11:13:18 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin)

Nordlöw <per.nordlow@gmail.com> wrote:

> How do I make a buffer-region become a link which is followed by
> clicking on it like in grep-mode. How do I change the color of a
> region?

I think the most comfortable way is the 'button package.

(define-button-type 'my-button
  'follow-link t
  'action 'my-action
  'help-echo "mouse-2, RET: Jump...")

(defun my-action (button)
  (goto-line (button-get button 'my-target)))

(let ((beg (point)))
  (insert "link")
  (make-text-button beg (point) 'type 'my-button 'my-target 25))

You can change the color by setting the 'face property.


regards,
Nikolaj Schumacher




reply via email to

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