emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Uniquely url-ify sentences?


From: Jason Dunsmore
Subject: Re: [O] Uniquely url-ify sentences?
Date: Mon, 07 Mar 2011 15:54:59 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

address@hidden (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]