emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jason Dunsmore <emacs-orgmode@dunsmor.com>
To: "Ross A. Laird" <ross@rosslaird.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Uniquely url-ify sentences?
Date: Mon, 07 Mar 2011 15:54:59 -0600	[thread overview]
Message-ID: <87ipvufvf0.fsf@riotblast.dunsmor.com> (raw)
In-Reply-To: <87tyfhfjdo.fsf@rosslaird.com> (Ross A. Laird's message of "Sat, 05 Mar 2011 11:38:11 -0800")

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

  reply	other threads:[~2011-03-07 21:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-05 19:38 Uniquely url-ify sentences? Ross A. Laird
2011-03-07 21:54 ` Jason Dunsmore [this message]
2011-03-17  9:50 ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2011-03-05 19:40 Ross A. Laird

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ipvufvf0.fsf@riotblast.dunsmor.com \
    --to=emacs-orgmode@dunsmor.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ross@rosslaird.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).