emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Adam Spiers <orgmode@adamspiers.org>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: unlinking links
Date: Thu, 06 Nov 2014 20:30:08 -0500	[thread overview]
Message-ID: <m2y4rn23xb.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <CAOkDyE-=z70r972A1iuPC+UUhtWHkknHmEZ_yA1NJFPZ6TWngw@mail.gmail.com> (Adam Spiers's message of "Thu, 6 Nov 2014 18:57:19 +0100")

Adam Spiers <orgmode@adamspiers.org> writes:

Try this:

(defun unlinkify ()
  "replace an org-link with the path, or description."
  (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
			(buffer-substring contents-begin contents-end))))
	(setf (buffer-substring start end) (or desc path))))))

> Hi all,
> 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 ;-)
> Regards,
> Adam

John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213

  reply	other threads:[~2014-11-07  1:30 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 [this message]
2014-12-04 14:48   ` Adam Spiers
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=m2y4rn23xb.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --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).