0

I was trying to delete a link and replace it with the description in org mode. And I thought there would be a command to do it. But I could not find one.

There is a solution here. But the question is dated. So, I thought I would ask again.

Is not there a built-in solution to remove the link but retain the description?

1 Answer 1

2

Just C-c C-l on the link and C-a C-k in the minibuffer to delete the link part will do it..

This used to produce an error before Org mode version 9.4, but it no longer does (see commit https://code.orgmode.org/bzg/org-mode/commit/6d62c76d2).

10
  • @NickD Thanks. It works. Though, a bit cumbersome. I wish there were a one command solution to the problem.
    – deshmukh
    May 10, 2021 at 8:28
  • Please thank @nichijou. He provided the answer: I just chased down the commit. As for a one-command solution, I doubt that there is much demand for it, but you can always write a function that does what the answer indicates and bind it to a key of your choice.
    – NickD
    May 10, 2021 at 12:04
  • ... or you could define a keyboard macro, name it, bind it to a key and save it for future sessions.
    – NickD
    May 10, 2021 at 13:45
  • 1
    I figured it was a change in lisp/ol.el since it was a change in link behavior. In my clone of the Org mode git repo, I then did git log --oneline -- lisp/ol.el. It was a bit of luck that I guessed right about lisp/ol.el, but the thirteenth commit from the top said "ol.el: Allow to remove the link part of a link" - bingo! I then took the SHA1 of it and found it in the "official" git repo (it's always at the URL in the link above - you just have to replace the commit ID with the one you want).
    – NickD
    May 10, 2021 at 14:22
  • 1
    @nichijou Thanks. I had two @ mentions in my earlier comment. Apparently, that was not allowed. And your name got deleted accidentally. I will be more careful.
    – deshmukh
    May 11, 2021 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.