emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Spiers <orgmode@adamspiers.org>
To: org-mode mailing list <emacs-orgmode@gnu.org>
Cc: John Kitchin <jkitchin@andrew.cmu.edu>
Subject: Re: unlinking links
Date: Thu, 4 Dec 2014 14:48:51 +0000	[thread overview]
Message-ID: <20141204144851.GF28615@pacific.linksys.moosehall> (raw)
In-Reply-To: <m2y4rn23xb.fsf@andrew.cmu.edu>

On Thu, Nov 06, 2014 at 08:30:08PM -0500, John Kitchin wrote:
> Adam Spiers <orgmode@adamspiers.org> writes:
> > Is it just me or is there no quick way to remove the link from some
> > hyperlinked text? If so, please consider this a feature request ;-)
> Try this:
> (defun unlinkify ()
>   "replace an org-link with the path, or description."
>   (interactive)
>   (let ((eop (org-element-context)))
>     (when (eq 'link (car eop))
> (message "%s" eop)
>       (let* ((start (org-element-property :begin eop))
> 	     (end (org-element-property :end eop))
> 	     (contents-begin (org-element-property :contents-begin eop))
> 	     (contents-end (org-element-property :contents-end eop))
> 	     (path (org-element-property :path eop))
> 	     (desc (and contents-begin
> 			contents-end
> 			(buffer-substring contents-begin contents-end))))
> 	(setf (buffer-substring start end) (or desc path))))))

Thanks, that worked great!  Can I suggest you submit this for
inclusion in org itself? :-)  I guess it would need to be called

  reply	other threads:[~2014-12-04 14:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 17:57 unlinking links Adam Spiers
2014-11-07  1:30 ` John Kitchin
2014-12-04 14:48   ` Adam Spiers [this message]
2014-12-04 17:07     ` Nicolas Goaziou
2014-12-10 23:30       ` Adam Spiers
2014-12-11 18:39         ` Nicolas Goaziou

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:

  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=20141204144851.GF28615@pacific.linksys.moosehall \
    --to=orgmode@adamspiers.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \


* 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


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).