all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Convert the region into an abbrev link
@ 2007-12-22 16:42 Bastien
  0 siblings, 0 replies; only message in thread
From: Bastien @ 2007-12-22 16:42 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-22 16:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-22 16:42 Convert the region into an abbrev link Bastien

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.