all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nikolaj Schumacher <me@nschum.de>
To: Nordlöw <per.nordlow@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Associating a region with a link
Date: Fri, 17 Oct 2008 11:13:18 +0200	[thread overview]
Message-ID: <m24p3bd1ox.fsf@nschum.de> (raw)
In-Reply-To: <e9d4c0c1-f011-49fc-a6f0-617773d58f26@h2g2000hsg.googlegroups.com> ("Nordlöw"'s message of "Fri\, 17 Oct 2008 01\:34\:24 -0700 \(PDT\)")

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




      parent reply	other threads:[~2008-10-17  9:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17  8:34 Associating a region with a link Nordlöw
2008-10-17  9:01 ` Lennart Borgman (gmail)
2008-10-17  9:13 ` Nikolaj Schumacher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m24p3bd1ox.fsf@nschum.de \
    --to=me@nschum.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=per.nordlow@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.