emacs-wiki-discuss
[Top][All Lists]
Advanced

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

[emacs-wiki-discuss] Re: accessing the description in a muse link


From: Michael Olson
Subject: [emacs-wiki-discuss] Re: accessing the description in a muse link
Date: Thu, 01 Sep 2005 22:49:56 -0500
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Brad Collins <address@hidden> writes:

> I want to be able to access the description string when you click on
> a link so that if a link points to a file that doesn't exist, the
> directory and file is created and the description automatically
> inserted into a skeleton.
>
> [snip]
>
> How can I access match 2 when a link is clicked?
>
> I'm not sure where to begin -- can I add a hook or something to save
> match 2 as a variable, or has this already been done somewhere?

Well, you could do:

(add-hook 'muse-explicit-link-functions 'my-insert-skeleton)

and then:

(defun my-insert-skeleton (&optional link)
  "Get match and link and do something funky."
  (interactive)
  ;; If link is specified, we're publishing, so don't do anything.
  ;; Otherwise, an explicit link should always be at point, but just
  ;; to be safe, abort if this isn't the case.
  (unless (or link
              (not (looking-at muse-explicit-link-regexp)))
    (let ((description (match-string 2)))
      (setq link (match-string 1)) ;; might as well use the existing name
      (do stuff ...)))
   nil)  ;; don't stop processing here

-- 
Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/
Interests: anime, Debian, XHTML, wiki, Emacs Lisp
  /` |\ | | | IRC: mwolson on freenode.net: #hcoop, #muse, #pulug
 |_] | \| |_| Jabber: mwolson_at_hcoop.net

Attachment: pgp6KtGktW1Ua.pgp
Description: PGP signature


reply via email to

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