From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: unlinking links Date: Thu, 04 Dec 2014 18:07:53 +0100 Message-ID: <87bnnjibrq.fsf@nicolasgoaziou.fr> References: <20141204144851.GF28615@pacific.linksys.moosehall> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwZs2-0004N5-L6 for emacs-orgmode@gnu.org; Thu, 04 Dec 2014 12:07:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwZru-0006zb-SK for emacs-orgmode@gnu.org; Thu, 04 Dec 2014 12:07:14 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:49483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwZru-0006z5-Nd for emacs-orgmode@gnu.org; Thu, 04 Dec 2014 12:07:06 -0500 In-Reply-To: <20141204144851.GF28615@pacific.linksys.moosehall> (Adam Spiers's message of "Thu, 4 Dec 2014 14:48:51 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Adam Spiers Cc: org-mode mailing list , John Kitchin Hello, Adam Spiers writes: > On Thu, Nov 06, 2014 at 08:30:08PM -0500, John Kitchin wrote: >> Adam Spiers 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. Regards, -- Nicolas Goaziou