This is a great idea. If you agree, I will incorporate
this into the C-c C-l command. Stored links will still be
accessible through <up> and <down>, while completion
will complete link prefixes like http, and also link
abbreviation prefixes.
- Carsten
On May 18, 2007, at 21:18, Bastien wrote:
Hello,
this function allows you to turn the region into a abbreviated link,
the
minibuffer being aware of the local #+LINK: options. With a prefix,
ask
for the link itself as well.
Comments & suggestions welcome !
=======================================================================
=
(defun bzg-org-link-this-region (&optional full)
"Turn the region into a abbreviated link.
With a prefix, ask the for link as well."
(interactive "P")
(when (org-region-active-p)
(let* ((beg (region-beginning))
(end (region-end))
(history (mapcar 'car org-link-abbrev-alist-local))
(desc (buffer-substring-no-properties beg end))
(link (if full (concat (completing-read "#+LINK: " history)
":" (read-from-minibuffer "Link: "))
(concat (completing-read "#+LINK: " history) ":" desc))))
(kill-region beg end)
(insert (org-make-link-string link desc)))))
=======================================================================
=
--
Bastien
_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477
_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode