[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Making Abbreviated links
From: |
Bastien |
Subject: |
[Orgmode] Making Abbreviated links |
Date: |
Fri, 18 May 2007 21:18:24 +0200 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.0 (gnu/linux) |
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
- [Orgmode] Making Abbreviated links,
Bastien <=