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
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-orgmode