From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Convert the region into an abbrev link Date: Sat, 22 Dec 2007 17:42:43 +0100 Message-ID: <87r6he65q4.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J67R3-00067s-Nn for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 11:42:49 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J67R2-00067f-MI for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 11:42:48 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J67R2-00067c-Ec for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 11:42:48 -0500 Received: from hu-out-0506.google.com ([72.14.214.238]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J67R2-0002pR-0T for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 11:42:48 -0500 Received: by hu-out-0506.google.com with SMTP id 23so1535027huc.1 for ; Sat, 22 Dec 2007 08:42:47 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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