emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Turning a link into a non-link
@ 2012-02-05  3:48 François Pinard
  2012-02-05  7:28 ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: François Pinard @ 2012-02-05  3:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi, Org mode people.

I sometimes want to turn [[POINTER][COMMENT]] into COMMENT.  That is, I
want to remove the clickability, but retain the text.

To do so, I try `C-c C-l', empty the pointer, type RET, leave the
comment as it is, and type RET.  Org mode reacts by writing "Empty link"
in the minibuffer, and removing the COMMENT from the text.

Could it keep COMMENT in the text, instead of deleting it?

François

P.S. The converse operation is easier! :-) For adding a POINTER to an
already existing COMMENT text, I first do `C-c l' somewhere, than select
COMMENT with the mouse, and complete with `C-c C-l RET RET'.

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

* Re: Turning a link into a non-link
  2012-02-05  3:48 Turning a link into a non-link François Pinard
@ 2012-02-05  7:28 ` Nick Dokos
  2012-02-05 13:01   ` François Pinard
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2012-02-05  7:28 UTC (permalink / raw)
  To: =?utf-8?Q?Fran=C3=A7ois?= Pinard; +Cc: nicholas.dokos, emacs-orgmode

François Pinard <pinard@iro.umontreal.ca> wrote:

> Hi, Org mode people.
> 
> I sometimes want to turn [[POINTER][COMMENT]] into COMMENT.  That is, I
> want to remove the clickability, but retain the text.
> 
> To do so, I try `C-c C-l', empty the pointer, type RET, leave the
> comment as it is, and type RET.  Org mode reacts by writing "Empty link"
> in the minibuffer, and removing the COMMENT from the text.
> 

This is done by org-make-link-string: it considers an empty link to
be an error. If you toggle-debug-on-error, you will get a backtrace.

> Could it keep COMMENT in the text, instead of deleting it?
> 

IMO, that'd be bad programming practice: you should write a separate
function that unlinks the link.

Nick

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

* Re: Turning a link into a non-link
  2012-02-05  7:28 ` Nick Dokos
@ 2012-02-05 13:01   ` François Pinard
  2012-02-05 13:24     ` François Pinard
  0 siblings, 1 reply; 4+ messages in thread
From: François Pinard @ 2012-02-05 13:01 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> writes:

> François Pinard <pinard@iro.umontreal.ca> wrote:

>> I sometimes want to turn [[POINTER][COMMENT]] into COMMENT.

> This is done by org-make-link-string: it considers an empty link to be
> an error.  If you toggle-debug-on-error, you will get a backtrace.

>> Could it [`C-c C-l' given an empty link] keep COMMENT in the text,
>> instead of deleting it?

> [...] you should write a separate function that unlinks the link.

OK, should easily be done on my side.  I perceived `C-c C-l' as a little
tool for editing links in various ways.  As it can already create a link
out of no link, it already "communicates with the void" enough, so I
thought it could delete a link as well as part of its general function.

May I guess that, given a dangling link, Org mode does not offer a way
for cleaning the link part without losing its text?  Shouldn't it?

François

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

* Re: Turning a link into a non-link
  2012-02-05 13:01   ` François Pinard
@ 2012-02-05 13:24     ` François Pinard
  0 siblings, 0 replies; 4+ messages in thread
From: François Pinard @ 2012-02-05 13:24 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

pinard@iro.umontreal.ca (François Pinard) writes:

>>> I sometimes want to turn [[POINTER][COMMENT]] into COMMENT.

>> [...] you should write a separate function that unlinks the link.

> OK, should easily be done on my side.

Just in case useful to others, I did it this way:


(defun fp-org-kill-link ()
  (interactive)
  (when (org-in-regexp org-bracket-link-regexp 1)
    (replace-match (match-string 3))))


François

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

end of thread, other threads:[~2012-02-05 13:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-05  3:48 Turning a link into a non-link François Pinard
2012-02-05  7:28 ` Nick Dokos
2012-02-05 13:01   ` François Pinard
2012-02-05 13:24     ` François Pinard

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