From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Dunsmore Subject: Re: Uniquely url-ify sentences? Date: Mon, 07 Mar 2011 15:54:59 -0600 Message-ID: <87ipvufvf0.fsf@riotblast.dunsmor.com> References: <87tyfhfjdo.fsf@rosslaird.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=33455 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwiON-0002Oi-3J for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 16:55:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwiOM-0005PO-45 for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 16:55:02 -0500 Received: from deathroller.dunsmor.com ([98.129.169.48]:38790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwiOL-0005Nd-VR for emacs-orgmode@gnu.org; Mon, 07 Mar 2011 16:55:02 -0500 In-Reply-To: <87tyfhfjdo.fsf@rosslaird.com> (Ross A. Laird's message of "Sat, 05 Mar 2011 11:38:11 -0800") 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: "Ross A. Laird" Cc: emacs-orgmode@gnu.org ross@rosslaird.com (Ross A. Laird) writes: > I'd like to post one sentence from this manuscript every day as a > tweet with a link back to the sentence Will this do what you need? --8<---------------cut here---------------start------------->8--- (defun org-linkify-sentence (url) "Converts a sentence to an Org-mode link." (interactive "sURL: ") (save-excursion (forward-char) (backward-sentence) (push-mark) (forward-sentence) (kill-region (region-beginning) (region-end)) (insert "[[" url "][" (first kill-ring) "]]"))) --8<---------------cut here---------------end--------------->8--- Just put the cursor on the sentence and type M-x org-linkify-sentence RET. You might want to create a keybinding for it if you use it often: (define-key org-mode-map "\C-cs" 'org-linkify-sentence) Also, I'd recommend creating a link abbreviation if you link to the same site often: http://orgmode.org/org.html#Link-abbreviations I have a series of custom org-linkify-* functions that I use to convert various pieces of text to Org-mode links. I'm still trying to figure out how they can be generalized to be useful to others. Regards, Jason