From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Making Abbreviated links Date: Mon, 21 May 2007 09:08:38 +0200 Message-ID: <4e52b634bfe0075885b25db6ed7befb0@science.uva.nl> References: <871whe0wlb.fsf@bzg.ath.cx> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hq2g9-00066B-Qz for emacs-orgmode@gnu.org; Mon, 21 May 2007 03:51:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hq2g6-0005yY-IO for emacs-orgmode@gnu.org; Mon, 21 May 2007 03:51:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hq2g6-0005y1-CZ for emacs-orgmode@gnu.org; Mon, 21 May 2007 03:51:38 -0400 Received: from korteweg.uva.nl ([146.50.98.70]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hq2g4-0000H1-ND for emacs-orgmode@gnu.org; Mon, 21 May 2007 03:51:37 -0400 In-Reply-To: <871whe0wlb.fsf@bzg.ath.cx> 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: Bastien Cc: emacs-orgmode@gnu.org This is a great idea. If you agree, I will incorporate this into the C-c C-l command. Stored links will still be accessible through and , while completion will complete link prefixes like http, and also link abbreviation prefixes. - Carsten On May 18, 2007, at 21:18, Bastien wrote: > 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 > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > -- Carsten Dominik Sterrenkundig Instituut "Anton Pannekoek" Universiteit van Amsterdam Kruislaan 403 NL-1098SJ Amsterdam phone: +31 20 525 7477