emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] unlinking links


From: Adam Spiers
Subject: Re: [O] unlinking links
Date: Thu, 4 Dec 2014 14:48:51 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Nov 06, 2014 at 08:30:08PM -0500, John Kitchin wrote:
> Adam Spiers <address@hidden> 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
`org-unlinkify'.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]