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

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

[emacs-wiki-discuss] Re: Change in emacs-wiki that affects Planner pages


From: Sacha Chua
Subject: [emacs-wiki-discuss] Re: Change in emacs-wiki that affects Planner pages
Date: Thu, 25 Nov 2004 12:31:49 +0900
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Michael Olson <address@hidden> writes:

> Due to a change in `emacs-wiki-link-(un)escape', the second part of
> any old extended links with spaces in them will show "%20" in place
> of a space.

I didn't want to change my old files, so I unescape %20 in the second
part of links. escape and unescape don't have to be perfectly
symmetrical. =)

Here's the workaround for people who are similarly lazy:

(defadvice emacs-wiki-link-unescape (around sacha activate)
  "Unescape dangerous characters in TEXT.

If FURTHER is set to t, which indicates link description,
unescape brackets and #.  If FURTHER is unspecified or nil, which
indicates link destination, unescape brackets and spaces."
  (setq ad-return-value
        (when text
          (save-match-data
            (emacs-wiki-replace-regexp-in-string
             "%5B" "["
             (emacs-wiki-replace-regexp-in-string
              "%5D" "]"
              (if further
                  (emacs-wiki-replace-regexp-in-string
                   "%23" "#" 
                   (emacs-wiki-replace-regexp-in-string
                    "%20" " " text))
                text)))))))

-- 
Sacha Chua <address@hidden> - open source geekette
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C
interests: emacs, gnu/linux, personal information management, CS ed
applying as a Debian new maintainer | looking for a grad school




reply via email to

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