emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Adam Spiers <orgmode@adamspiers.org>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>,
	John Kitchin <jkitchin@andrew.cmu.edu>
Subject: Re: unlinking links
Date: Thu, 04 Dec 2014 18:07:53 +0100	[thread overview]
Message-ID: <87bnnjibrq.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <20141204144851.GF28615@pacific.linksys.moosehall> (Adam Spiers's message of "Thu, 4 Dec 2014 14:48:51 +0000")


Adam Spiers <orgmode@adamspiers.org> writes:

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

(when (eq (org-element-type eop) 'link)

>> (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
> `org-unlinkify'.

FWIW, I don't think it is useful enough for inclusion in core. It could
go in Worg however.


Nicolas Goaziou

  reply	other threads:[~2014-12-04 17:07 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
2014-12-04 17:07     ` Nicolas Goaziou [this message]
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=87bnnjibrq.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    --cc=orgmode@adamspiers.org \


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