[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] Re: Enclose all links in [[]]
From: |
Sacha Chua |
Subject: |
[emacs-wiki-discuss] Re: Enclose all links in [[]] |
Date: |
Mon, 12 Sep 2005 23:49:17 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
David Ellis <address@hidden> writes:
> I am trying to transfer my planner pages to my Palm PDA and use a wiki
> program on it to link the pages together. The problem that I am having
> is that the Palm program does not use the dates as links. Can anyone
> tell me how to alter one of the lisp files to get the brackets around
> the dates and perhaps around all of the plan page links.
The following code will add brackets around new page links, but not URLs.
(defun emacs-wiki-make-link (link &optional name)
"Return a Wiki link to LINK with NAME as the text."
(let ((case-fold-search nil))
(unless name
(setq name (emacs-wiki-wiki-visible-name link)))
(when (string-match "^\\[\\[\\([^]]+\\)\\]" link)
(setq link (match-string 1 link)))
(when (equal name link)
(setq name nil))
(cond
(name
(concat "[[" (emacs-wiki-link-escape link)
"][" (emacs-wiki-link-escape name t) "]]"))
((string-match (concat "^\\(?:" emacs-wiki-url-regexp "\\)") link)
(emacs-wiki-link-escape link))
(t (concat "[[" (emacs-wiki-link-escape link) "]]")))))
Adding brackets to old ones might be more work, but you can probably
use a regexp search for planner-date-regexp and then make sure it's
not part of a [[link]] already... Hmm.
If you don't have a lot of pages, a keyboard macro or
query-replace-regexp would be easy to set up and control. If you have
a lot of pages, maybe something fancier with Emacs Lisp or Perl?
--
Sacha Chua <address@hidden> - open source geekette
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C
interests: emacs, gnu/linux, personal information management, juggling
sachac on irc.freenode.net#emacs . YM: sachachua83