emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* unlinking links
@ 2014-11-06 17:57 Adam Spiers
  2014-11-07  1:30 ` John Kitchin
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Spiers @ 2014-11-06 17:57 UTC (permalink / raw)
  To: org-mode mailing list

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: unlinking links
  2014-11-06 17:57 unlinking links Adam Spiers
@ 2014-11-07  1:30 ` John Kitchin
  2014-12-04 14:48   ` Adam Spiers
  0 siblings, 1 reply; 6+ messages in thread
From: John Kitchin @ 2014-11-07  1:30 UTC (permalink / raw)
  To: Adam Spiers; +Cc: org-mode mailing list

Adam Spiers <orgmode@adamspiers.org> writes:

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


> 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
Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: unlinking links
  2014-11-07  1:30 ` John Kitchin
@ 2014-12-04 14:48   ` Adam Spiers
  2014-12-04 17:07     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Spiers @ 2014-12-04 14:48 UTC (permalink / raw)
  To: org-mode mailing list; +Cc: John Kitchin

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: unlinking links
  2014-12-04 14:48   ` Adam Spiers
@ 2014-12-04 17:07     ` Nicolas Goaziou
  2014-12-10 23:30       ` Adam Spiers
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2014-12-04 17:07 UTC (permalink / raw)
  To: Adam Spiers; +Cc: org-mode mailing list, John Kitchin

Hello,

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.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: unlinking links
  2014-12-04 17:07     ` Nicolas Goaziou
@ 2014-12-10 23:30       ` Adam Spiers
  2014-12-11 18:39         ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Spiers @ 2014-12-10 23:30 UTC (permalink / raw)
  To: org-mode mailing list, John Kitchin

On Thu, Dec 04, 2014 at 06:07:53PM +0100, Nicolas Goaziou wrote:
> 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.

Why not?  Or perhaps I should ask: how is it determined whether
something's useful enough for core? :-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: unlinking links
  2014-12-10 23:30       ` Adam Spiers
@ 2014-12-11 18:39         ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2014-12-11 18:39 UTC (permalink / raw)
  To: Adam Spiers; +Cc: org-mode mailing list, John Kitchin

Adam Spiers <orgmode@adamspiers.org> writes:

>> FWIW, I don't think it is useful enough for inclusion in core.
>
> Why not?

Because we cannot possibly stuff everything related to Org in core.

The function saves a few keystrokes, but considering how often I expect
it to be used, the benefit from using it seems rather negligible.

OTOH, putting it on Worg gives it some exposure, so it isn't lost in the
mailing list archives.

Of course, this is all IMO, and other developers, or Bastien, could
disagree.

> Or perhaps I should ask: how is it determined whether
> something's useful enough for core? :-)

As for myself, the following works surprisingly well in various
situations:

  (defun ngz-answering-helper (&optional from-wife-p)
    (cond (from-wife-p 'yes)
          ((= (random 10) 0) 'yes)
          (t 'no)))

Regards,

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-11 18:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2014-12-10 23:30       ` Adam Spiers
2014-12-11 18:39         ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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