Brad Collins <[EMAIL PROTECTED]> 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: pgpqgTGmGeDkJ.pgp
Description: PGP signature

_______________________________________________
emacs-wiki-discuss mailing list
emacs-wiki-discuss@nongnu.org
http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss

Reply via email to