[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Convert the region into an abbrev link
From: |
Bastien |
Subject: |
[Orgmode] Convert the region into an abbrev link |
Date: |
Sat, 22 Dec 2007 17:42:43 +0100 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.0 (gnu/linux) |
Hi list,
I'm regularily using Org for taking notes in meetings. It's very handy
to be able to send a HTML/PDF report to everyone quickly. While doing
this, I like to link some parts of the text that need to be searched
further, after the meeting.
Then I'm using this small function to convert the selected text into a
google search:
(defun bzg-org-googlify-region (beg end)
"Convert the selected region into a google search.
This requires that \"google\" is an abbreviated link for
http://www.google.com/search?q=%s"
(interactive "r")
(let ((query (buffer-substring beg end)))
(delete-region beg end)
(insert (org-make-link-string (concat "google:" query) query))))
This can be generalized for any kind of abbreviated link:
(defun bzg-org-abbrev-linkify-region (beg end)
"Convert the selected region into an abbreviated link."
(interactive "r")
(let ((abbrev
(completing-read
"Abbrev: "
(mapcar (lambda (x) (list (concat (car x) ":")))
(append org-link-abbrev-alist-local
org-link-abbrev-alist))))
(reg (buffer-substring beg end)))
(delete-region beg end)
(insert (org-make-link-string (concat abbrev reg) reg))))
I guess this might be useful to other people...
--
Bastien
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Orgmode] Convert the region into an abbrev link,
Bastien <=