Matt Hodges <[EMAIL PROTECTED]> writes: > Suppose I write a link [[foo][bar]] and move to it with > emacs-wiki-next-reference. When I try and edit it with > emacs-wiki-edit-link-at-point, in the edit process the link is > presented as "[[foo][bar]]", and the text as "[bar]", rather than > "foo" and "bar", respectively.
Thanks for the report! I think I've fixed this in the development
version. A release should be on the way next week. In the meantime,
can you copy the following two functions to the *scratch* buffer, hit
M-C-x on each one, and see if the problem goes away for the current
Emacs session?
(defun emacs-wiki-link-at-point (&optional pos)
"Return non-nil if a URL or Wiki link name is at point."
(if (or (null pos)
(and (char-after pos)
(not (eq (char-syntax (char-after pos)) ? ))))
(let ((case-fold-search nil)
(here (or pos (point)))
there)
(save-excursion
(goto-char here)
(skip-chars-backward (concat "^['\"<>{}("
emacs-wiki-regexp-space))
(setq there (point))
(search-backward "[[" (line-beginning-position) t)
(or (and (looking-at emacs-wiki-name-regexp)
(<= here (match-end 0)))
(and (goto-char there)
(looking-at emacs-wiki-url-or-name-regexp)))))))
(defun emacs-wiki-edit-link-at-point ()
"Edit the current link.
Do not rename the wiki page originally referred to."
(interactive "*")
(if (emacs-wiki-link-at-point)
(let* ((old-link (match-string-no-properties 1))
(old-text (match-string-no-properties 3))
(match-start (match-beginning 0))
(match-end (match-end 0))
(link (emacs-wiki-make-link
(read-string "Link: "
(emacs-wiki-link-unescape old-link))
(when old-text
(read-string
"Text: "
(emacs-wiki-link-unescape old-text t))))))
(delete-region match-start match-end)
(insert link))
(error "There is no valid link at point")))
--
Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/
Jabber: mwolson_at_hcoop.net -- IRC: mwolson on freenode.net: #muse, #pulug
/~ |\ | | | Interests: animÃ, Debian GNU/Linux, XHTML, wiki, Lisp
|_] | \| |_| Fun quotes: http://www.mwolson.org/plans/QuoteList.html
pgpvKsM1tBhrK.pgp
Description: PGP signature

